ALLBASE/SQL Reference Manual (36216-90216)

Chapter 10 339
SQL Statements A - D
CREATE PROCEDURE
CREATE PROCEDURE
The CREATE PROCEDURE statement defines a procedure for storage in a DBEnvironment. A
procedure may subsequently be executed through the firing of a rule by an INSERT,
UPDATE, or DELETE statement, or by using the EXECUTE PROCEDURE statement or a
procedure cursor.
Scope
ISQL or Application Programs
SQL Syntax
CREATE PROCEDURE [
Owner.
]
ProcedureName
[LANG =
ProcLangName
]
[(ParameterDeclaration [,
ParameterDeclaration
][...])]
[WITH RESULT
ResultDeclaration
[,
ResultDeclaration
][...]]
AS BEGIN [
ProcedureStatement
][...] END [IN
DBEFileSetName
]
Parameters
[
Owner
.]
ProcedureName
specifies the owner and the name of the procedure. If an owner
name is not specified, the owner is the current user's DBEUserID or the
schema's authorization name, or the ISQL SET OWNER value. You can
specify the owner of the new procedure if you have DBA authority. If you
do not have DBA authority, you can specify as owner the name of any
group of which you are a member. Two procedures cannot have the same
owner and procedure name.
ProcLangName
is the name of the default language used within the procedure for
parameters and local variables. This language may be either the language
of the DBEnvironment or n-computer. The default is the language of the
DBEnvironment.
ParameterDeclaration
specifies the attributes of parameter data to be passed to or
from the procedure. The syntax of
ParameterDeclaration
is presented
separately below.
ResultDeclaration
specifies the attributes of a result column in a multiple row result
set or sets returned from a procedure to an application or ISQL. The
syntax of
ResultDeclaration
is presented separately below.
ProcedureStatement
Specifies a statement in the procedure body. The statement may
be any one of the following:
Local variable declaration (see DECLARE
Variable
).
Parameter or local variable assignment (see Assignment).
Compound statement. A compound statement has the following syntax:
BEGIN [
Statement
;] [...] END;
Control flow and status statements