DECLARE Procedure SQL statement
Description
Declares a procedure for the specified transaction object.
DBMS-specific
Not all DBMSs support stored procedures.
Syntax
|
1 |
DECLARE <span>ProcedureName</span> PROCEDURE FOR <br> <span>StoredProcedureName</span><br> @<span>Param1</span>=<span>Value1</span>, @<span>Param2</span>=<span>Value2</span>,...<br> {USING <span>TransactionObject</span>}; |
|
Parameter |
Description |
|---|---|
|
ProcedureName |
Any valid PowerBuilder name. |
|
StoredProcedureName |
Any stored procedure in the database. |
|
@Paramn=Valuen |
The name of a parameter (argument) defined |
|
TransactionObject |
The name of the transaction object for |
Usage
DECLARE Procedure is a nonexecutable command.
It is analogous to declaring a variable.
To declare a local procedure, open the script in the Script
view and select Paste SQL from
the PainterBar or the Edit>Paste Special menu. To declare
a global, instance, or shared procedure, select Declare from the
first drop-down list in the Script view and Global Variables, Instance
Variables, or Shared Variables from the second drop-down list, then
select Paste SQL.
For information about global, instance, shared,
and local scope, see “Where to declare variables “.
Examples
This statement declares the Sybase ASE procedure Emp_proc for the
database specified in the default transaction object. It references
the Emp_name_var and Emp_sal_var variables,
which must be set to appropriate values before you execute the EXECUTE Emp_proc command:
|
1 |
DECLARE Emp_proc procedure for GetName |
|
1 |
@emp_name = :Emp_name_var, |
|
1 |
@emp_salary = :Emp_sal_var ; |
This statement declares the ORACLE procedure Emp_proc for the
database specified in the default transaction object. It references
the Emp_name_var and Emp_sal_var variables,
which must be set to appropriate values before you execute the EXECUTE Emp_proc command:
|
1 |
DECLARE Emp_proc procedure for GetName |
|
1 |
(:Emp_name_var, :Emp_sal_var) ; |