CREATE PROCEDURE

A stored procedure is a collection of statements that can be called from other queries or other stored procedures.

Grammar Syntax for SQL procedures

CREATE [OR REPLACE] PROCEDURE [IF NOT EXISTS]
[[project_name.]dataset_name.]procedure_name (procedure_argument[, ...] )
[OPTIONS(procedure_option_list)]
BEGIN
multi_statement_query
END;

procedure_argument: [procedure_argument_mode] argument_name argument_type

procedure_argument_mode: IN | OUT | INOUT

Click here to go to the BigQuery specification for this syntax.

Sample Source Patterns

Basic case

CREATE OR REPLACE PROCEDURE test.proc1()
BEGIN
  RETURN;
END;

IN Parameter Mode

IN mode parameter is removed, not required in Snowflake.

OUT Parameter Mode

Snowflake does not allow OUTPUT parameters in procedures, one way to simulate this behavior is return its value at the end of the procedure.

INOUT Parameter Mode

Same behavior as output parameters

Options Clause

BigQuery
Snowflake

strict_mode

Not supported in Snowflake, but by default the strict_mode is false.

description

Last updated

Was this helpful?