Online Documentation for SQL Manager for InterBase/Firebird

Procedures


A Procedure is a set of procedural constructs and embedded SQL statements that is stored in the database and can be called by name.

 

A Stored procedure is a self-contained program written in InterBase procedure and trigger language, and stored as part of a database's metadata. Stored procedures can be invoked directly from applications, or can be substituted for a table or view in a SELECT statement. Stored procedures can receive input parameters from and return values to applications and can execute on the server.

 

Creating Procedures

Hint: To create a new procedure, you can also right-click the Procedures node or any object within this node in the DB Explorer tree and select the New Procedure... item from the context menu.

 

To create a new procedure with the same properties as one of existing procedures has:

Alternatively, you can right-click a procedure in the DB Explorer tree and select the Duplicate Procedure <procedure_name>... context menu item.

 

Duplicate Object Wizard allows you to select the database to create a new procedure in, and to view the result SQL statement for creating the procedure.

 

Editing Procedures

To edit an existing procedure:

  • select the procedure for editing in the DB Explorer tree (type the first letters of the procedure name for quick search);
  • right-click the object and select the Edit Procedure <procedure_name> context menu item, or simply double-click the procedure;
  • edit procedure definition using the appropriate tabs of Procedure Editor.

To change the name of a procedure:

  • select the procedure to rename in the DB Explorer tree;
  • right-click the procedure alias and select the Rename Procedure <procedure_name>... item from the context menu;
  • edit the procedure name using the Rename Object... dialog.

 

Executing Procedures

  • select the procedure to execute in the DB Explorer tree (type the first letters of the procedure name for quick search);
  • right-click the object and select the Edit Procedure <procedure_name>... context menu item, or simply double-click the procedure;
  • execute the procedure using the Execute Procedure Navigation bar item of Procedure Editor.

 

Debugging Procedures

 

Dropping Procedures

  • select the procedure to drop in the DB Explorer tree;
  • right-click the object and select the Drop Procedure <procedure_name>... context menu item;
  • confirm dropping in the dialog window.

 

Note: If more convenient, you can also use the following shortcuts:

Ctrl+N to create a new procedure;

Ctrl+O to edit the selected procedure;

Ctrl+R to rename the procedure;

F9 to execute the procedure;

Shift+Ctrl+F9 to debug the procedure;

Shift+Del to drop the object from the database.