Use this window to set up a new SQL procedure or edit an existing
SQL procedure.
Complete this window as follows:
- Name
- Type a unique name for the procedure. If you are editing a procedure,
you cannot change the name.
Tip: When creating
ObjectServer objects, their names must begin with an uppercase or
lowercase letter, followed by uppercase or lowercase letters, numbers,
or underscore (_) characters, up to 40 characters in length. User,
group, and role names can be any text string up to 64 characters in
length and can include spaces. Names of ObjectServer objects are
case-sensitive.
- Parameters
- This area displays the parameters that have been created for passing into
and out of the procedure.
- You can use the up and down arrows to the right of the list box to change
the order of any selected parameter. You can also click Remove
parameter to the right of the list box to remove any selected
parameter from the list.
- To create a parameter, use the In/Out, Name,
and Data Type fields, the Array check
box (if necessary), and the Add parameter to the list button.
- In/Out
- Select a mode for the parameter being created. Each procedure parameter
has a mode, which can be in, out,
or in out. Depending on the mode you choose for your
parameters, you can use them in different ways.
- Name
- Type a name for the parameter being created. Parameter names must be unique
within the procedure.
Tip: When creating
ObjectServer objects, their names must begin with an uppercase or
lowercase letter, followed by uppercase or lowercase letters, numbers,
or underscore (_) characters, up to 40 characters in length. User,
group, and role names can be any text string up to 64 characters in
length and can include spaces. Names of ObjectServer objects are
case-sensitive.
- Data Type
- Select the type of data that the parameter can pass into or out of the
procedure. The data type can be any valid ObjectServer data type except VARCHAR
or INCR.
- Array
- If you selected the in mode from the In/Out drop-down
list, you can select this check box to pass an array of the selected data
type into the procedure.
- Add parameter to the list
- After completing the In/Out, Name,
and Data Type fields, and the optional Array check
box, click this button to add the parameter to the parameter list.
- Actions
- Type the SQL commands for this procedure. The body of a procedure contains
a set of SQL commands and programming constructs that manipulate data in the
ObjectServer. The body of a procedure is enclosed within the keywords BEGIN
and END. Each statement, except the last one, must be separated by a semi-colon
(;).
- You can optionally define (declare) local variables for use within a procedure.
A local variable is a placeholder for values used during the execution of
the procedure. Local variable declarations within a procedure must be separated
by semi-colons (;).
- You can use the SQL helper buttons shown to the right of the SQL editor
panel to construct the SQL commands.
Saving your
SQL procedure
After creating or editing an SQL procedure, you can
save or cancel the changes made by clicking the relevant button as follows:
- OK
- Click this button to save the SQL procedure and close the window. New
SQL procedures are added to the Procedures pane.
- Cancel
- Click this button to close the window without saving your changes.