SnowConvert AI - Oracle - CREATE PROCEDURE¶
Oracle Create Procedure to Snowflake Snow Scripting
Description¶
Note
Some parts in the output code are omitted for clarity reasons.
A procedure is a group of PL/SQL statements that you can call by name. A call specification (sometimes called call spec) declares a Java method or a third-generation language (3GL) routine so that it can be called from SQL and PL/SQL. The call spec tells Oracle Database which Java method to invoke when a call is made. It also tells the database what type conversions to make for the arguments and return value. Oracle SQL Language Reference Create Procedure.
For more information regarding Oracle Create Procedure, check here.
Oracle Create Procedure Syntax¶
For more information regarding Snowflake Create Procedure, check here.
Snowflake Create Procedure Syntax¶
Sample Source Patterns¶
1. Basic Procedure¶
Oracle¶
Snow Scripting¶
2. Procedure with Different Parameters¶
Oracle¶
Snow Scripting¶
Output parameters¶
Snowflake does not allow output parameters in procedures, a way to simulate this behavior could be to declare a variable and return its value at the end of the procedure.
Parameters with default values¶
Snowflake does not allow setting default values for parameters in procedures, a way to simulate this behavior could be to declare a variable with the default value or overload the procedure.
3. Procedure with Additional Settings¶
Oracle¶
Snow Scripting¶
4. Procedure with Basic Statements¶
Oracle¶
Snow Scripting¶
5. Procedure with empty RETURN statements¶
In Oracle procedures you can have empty RETURN statements to finish the execution of a procedure. In Snowflake Scripting procedures can have RETURN statements but they must have a value. By default all empty RETURN statements are converted with a NULL value.
Oracle¶
Snowflake Scripting¶
RETURN statements in procedures with output parameters¶
In procedures with output parameters, instead of a NULL value an OBJECT_CONSTRUCT will be used in the empty RETURN statements to simulate the output parameters in Snowflake Scripting.
Oracle¶
Snowflake Scripting¶
6. Procedure with DEFAULT parameters¶
DEFAULT parameters allow named parameters to be initialized with default values if no value is passed.
Oracle¶
Snowflake Scripting¶
Known Issues¶
1. Unsupported OUT parameters¶
Snowflake procedures do not have a native option for output parameters.
2. Unsupported Oracle additional settings¶
The following Oracle settings and clauses are not supported by Snowflake procedures:
sharing_clausedefault_collation_optioninvoker_rights_clauseaccessible_by_clausejava_declarationc_declaration