CREATE PROCEDURE
Oracle Create Procedure to Snowflake Snow Scripting
Description
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.
CREATE [ OR REPLACE ] [ EDITIONABLE | NONEDITIONABLE ]
PROCEDURE
[ schema. ] procedure_name
[ ( parameter_declaration [, parameter_declaration ]... ) ] [ sharing_clause ]
[ ( default_collation_option | invoker_rights_clause | accessible_by_clause)... ]
{ IS | AS } { [ declare_section ]
BEGIN statement ...
[ EXCEPTION exception_handler [ exception_handler ]... ]
END [ name ] ;
|
{ java_declaration | c_declaration } } ;For more information regarding Snowflake Create Procedure, check here.
CREATE [ OR REPLACE ] PROCEDURE <name> ( [ <arg_name> <arg_data_type> ] [ , ... ] )
RETURNS <result_data_type> [ NOT NULL ]
LANGUAGE SQL
[ { CALLED ON NULL INPUT | { RETURNS NULL ON NULL INPUT | STRICT } } ]
[ VOLATILE | IMMUTABLE ]
[ COMMENT = '<string_literal>' ]
[ EXECUTE AS { CALLER | OWNER } ]
AS '<procedure_definition>'Sample Source Patterns
1. Basic Procedure
2. Procedure with Different Parameters
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
4. Procedure with Basic Statements
5. Procedure with empty RETURN statements
RETURN statementsIn 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.
RETURN statements in procedures with output parameters
RETURN statements in procedures with output parametersIn 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.
Known Issues
1. Unsupported OUT and the default value for parameters
Snowflake procedures do not have a native option for output parameters, or to set a default value for them.
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
Related EWIS
MSCEWI1058: Functionality is not currently supported by Snowflake Scripting.
MSCEWI3097: Procedure Properties are Not Supported in Snowflake Procedures.
Last updated
Was this helpful?