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;CREATE OR REPLACE PROCEDURE test.proc1 ()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
BEGIN
RETURN 'SUCCESS';
END;
$$;IN Parameter Mode
OUT Parameter Mode
INOUT Parameter Mode
Options Clause
BigQuery
Snowflake
strict_mode
Not supported in Snowflake, but by default the strict_mode is false.
description
Not supported options are removed from the output code.
Last updated
Was this helpful?