AWAIT (Snowflake Scripting) | Snowflake Documentation (original) (raw)

ReferenceScripting referenceAWAIT

Waits for all asynchronous child jobsthat are running to finish or for a specific asynchronous child job that is running for aRESULTSET to finish, then returns when the all jobs have finished or the specific job has finished, respectively.

AWAIT is a blocking call. You can use an AWAIT statement to block other code from running until the AWAIT call completes.

See also:

CANCEL

Syntax

AWAIT { ALL | };

Where:

ALL

The stored procedure waits for all asynchronous child jobs that were started before the AWAIT call.

_resultsetname_

The stored procedure waits for the asynchronous child job that is running for the specified RESULTSET to finish.

Usage notes

Examples

Wait for all asynchronous child jobs to complete:

Wait for an asynchronous child job that is running for a RESULTSET to complete:

For more examples, see Examples of using asynchronous child jobs.