CREATE PROCEDURE
CREATE PROCEDURE procedure_name [(parameter_definition [, parameter_definition ...])]
[RETURNS (output_column_definition
[, output_column_definition ...])]
[SQL_data_access_indication]
[LANGUAGE SQL] BEGIN procedure_body END;
parameter_definition ::= [parameter_mode] parameter_name data_type output_column_definition::= column_name column_type
SQL_data_access_indication::= CONTAINS SQL | READS SQL DATA | MODIFIES SQL DATA | NO SQL
procedure_body ::= [declare_statement; ...][procedure_statement; ...]
parameter_mode ::= IN | OUT | INOUT
declare_statement ::= DECLARE variable_name data_type
procedure_statement ::= prepare_statement | execute_statement |
fetch_statement | control_statement | post_statement |
wait_event_statement | wait_register_statement | exec_direct_statement |
writetrace_statement | sql_dml_or_ddl_statement
prepare_statement ::= EXEC SQL PREPARE
{ cursor_name | CURSORNAME( { string_literal | variable } ) }
sql_statement
execute_statement ::=
EXEC SQL EXECUTE cursor_name
[USING (variable [, variable ...])]
[INTO (variable [, variable ...])] |
EXEC SQL CLOSE cursor_name |
EXEC SQL DROP cursor_name |
EXEC SQL {COMMIT | ROLLBACK} WORK |
EXEC SQL SET TRANSACTION {READ ONLY | READ WRITE} |
EXEC SQL WHENEVER SQLERROR {ABORT | ROLLBACK [WORK], ABORT}
EXEC SEQUENCE sequence_name.CURRENT INTO variable |
EXEC SEQUENCE sequence_name.NEXT INTO variable |
EXEC SEQUENCE sequence_name SET VALUE USING variable
fetch_statement ::= EXEC SQL FETCH cursor_name
cursor_name ::= literal
post_statement ::= POST EVENT event_name [(parameters)]
wait_event_statement ::=
WAIT EVENT
[event_specification ...]
END WAIT
event_specification ::=
WHEN event_name [(parameters)]
BEGIN statements
END EVENT
wait_register_statement ::=
REGISTER EVENT event_name |
UNREGISTER EVENT event_name
writetrace_statement ::= WRITETRACE(string)
control_statement ::=
SET variable_name = value | variable_name ::= value |
WHILE expression
LOOP procedure_statement... END LOOP |
LEAVE |
IF expression THEN procedure_statement ...
[ ELSEIF procedure_statement ... THEN] ...
ELSE procedure_statement ... END IF |
RETURN | RETURN SQLERROR OF cursor_name | RETURN ROW |
RETURN NOROW
exec_direct_statement ::=
EXEC SQL [USING (variable [, variable ...])] [CURSORNAME(variable)]
EXECDIRECT sql_dml_or_ddl_statement |
EXEC SQL cursor_name
[USING (variable [, variable ...])]
[INTO (variable [, variable ...])]
[CURSORNAME(variable)]
EXECDIRECT sql_dml_or_ddl_statement
See
See also