SnowConvert AI - IBM DB2 - CREATE PROCEDURE¶
Description¶
Creates a new stored procedure or replaces an existing procedure for the current database. (IBM DB2 SQL Language Reference Create Procedure).
Grammar Syntax¶
The following is a SQL syntax for creating a procedure in IBM Db2. See the DB2 CREATE PROCEDURE specification.
Sample Source Patterns¶
Input Code:¶
Db2¶
Output Code:¶
Snowflake¶
DECLARE¶
Description¶
Section to declare all the procedure variables except for loop variables.
Db2 supports multiple DECLARE sections per block statement, since Snowflake does not support this behavior they must be merged into a single declaration statement per block.
Grammar Syntax¶
Sample Source Patterns¶
Input Code:¶
Db2¶
Output Code:¶
Snowflake¶
Known Issues¶
There are no known issues.
Related EWIs.¶
There are no related EWIs.
EXCEPTION¶
Description¶
Db2 handles exceptions with handlers declared in the block. A handler can be CONTINUE (execution continues) or EXIT (leaves the block) and can catch general or specific conditions (for example, SQLEXCEPTION, SQLSTATE 'state', SQLCODE code).
Grammar Syntax¶
Sample Source Patterns¶
Input Code:¶
Db2¶
Output Code:¶
Snowflake¶
Known Issues¶
There are no known issues.
Related EWIs.¶
There are no related EWIs.
LABEL¶
Description¶
Labels are used in Db2 to qualify a block or to use the EXIT or END statement. Snowflake does not support labels. However, a workaround is used for accessing outer-block-declared variables which can be accessed by the fully qualified name, such as outer_block.variable_name
Warning
Since labels are not supported in Snowflake, an EWI will be printed.
Grammar Syntax¶
Sample Source Patterns¶
Input Code:¶
Db2¶
Output Code:¶
Snowflake¶
Known Issues¶
If a variable name is the same as a modified one, it will cause inconsistencies.
Related EWIs¶
There are no related EWIs.
VARIABLE DECLARATION¶
Description¶
Declare variables inside the block’s DECLARE area. Variables can specify an initial value using DEFAULT. Subsequent assignments use the SET statement.
Note
Variable declarations are fully supported by Snowflake.
Grammar Syntax¶
Notes:
Use
SET name = expression;to assign after declaration.
Sample Source Patterns¶
Input Code:¶
Db2¶
Output Code:¶
Snowflake¶
Known Issues ¶
No issues were found.
Related EWIs¶
There are no related EWIs.
SET¶
Description¶
Assign a value to a variable within a procedure block.
Grammar Syntax¶
Sample Source Patterns¶
Input Code:¶
Db2¶
Output Code:¶
Snowflake¶
IF¶
Description¶
Evaluate conditions and execute different branches. Db2 supports ELSEIF and an optional ELSE branch.
Grammar Syntax¶
Sample Source Patterns¶
Input Code:¶
Db2¶
Output Code:¶
Db2¶
Known Issues¶
There are no known issues.
Related EWIs.¶
There are no related EWIs.