3.6. Stored Procedures

BigQuery standard SQL supports stored procedures. A stored procedure can include one or more SQL statements and additional logic. This is documented at https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_procedure.

In terms of metadata, BigQuery treats SQL statements within a stored procedure as child jobs of the parent job script that contains the call of the stored procedure. For additional information about how scripts are handled see Section 3.5, “Scripting”. Because both a parent job and child jobs can appear in metadata, care should be taken to avoid double counting metrics when aggregating.

See links below for references.