CREATE PROCEDURE statement
Description
Parameters
454
"GRANT statement" on page 540
"Using Procedures, Triggers, and Batches" on page 435 of the book ASA
User's Guide
The CREATE PROCEDURE statement creates a procedure in the database.
Users with DBA authority can create procedures for other users by
specifying an owner. A procedure is invoked with a CALL statement.
CREATE PROCEDURE clause
rules for other database identifiers such as column names. They must be a
valid SQL data type (see "SQL Data Types" on page 263), and must be
prefixed by one of the keywords IN, OUT or INOUT. The keywords have
the following meanings:
♦
The parameter is an expression that provides a value to the
IN
procedure.
♦
OUT
The parameter is a variable that could be given a value by the
procedure.
♦
The parameter is a variable that provides a value to the
INOUT
procedure, and could be given a new value by the procedure.
When procedures are executed using the CALL statement, not all parameters
need to be specified. If a default value is provided in the CREATE
PROCEDURE statement, missing parameters are assigned the default values.
If an argument is not provided in the CALL statement, and no default is set,
an error is given.
SQLSTATE and SQLCODE are special parameters that output the
SQLSTATE or SQLCODE value when the procedure ends (they are OUT
parameters). Whether or not a SQLSTATE and SQLCODE parameter is
specified, the SQLSTATE and SQLCODE special values can always be
checked immediately after a procedure call to test the return status of the
procedure.
The SQLSTATE and SQLCODE special values are modified by the next
SQL statement. Providing SQLSTATE or SQLCODE as procedure
arguments allows the return code to be stored in a variable.
RESULT clause
The RESULT clause declares the number and type of
columns in the result set. The parenthesized list following the RESULT
keyword defines the result column names and types. This information is
returned by the Embedded SQL DESCRIBE or by ODBC SQLDescribeCol
when a CALL statement is being described. Allowable data types are listed
in "SQL Data Types" on page 263.
$
For more information on returning result sets from procedures, see
"Returning results from procedures" on page 466 of the book ASA User's
Guide.
Parameter names must conform to the
Need help?
Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?
Questions and answers