SQL procedures have the following major components: parameters,
local variable declarations, and the procedure body.
About this task
Parameters are values that are passed into or out of a
procedure. You declare parameters when you create a procedure, and
you specify what values are passed as parameters when you run the
procedure.
Local variable declarations are declared before the
procedure body, and can be used to define values that are used when
the procedure runs.
To create or edit an SQL procedure:
Procedure
- From the Netcool/OMNIbus Administrator window,
select the Automation menu button.
- Click Procedures. The Procedures pane
opens.
- To add an SQL procedure, click Add SQL Procedure in
the toolbar. The SQL Procedure Details window
opens.
- To edit an SQL procedure, select the SQL procedure to edit
and then click Edit Procedure in the toolbar. The SQL Procedure Details window
opens.
- 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.
- Save or cancel your changes 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.
What to do next
After you create a procedure in the ObjectServer, you can
run it from the SQL interactive interface (
iSQL),
or run it in a trigger using the EXECUTE PROCEDURE command.