Begin---End is used in Data Projects for data movement and parallelization.


[AS <identifier>] [PARALLEL <number> ] [GROUPED] [ON ERROR ( CANCEL | IGNORE ) ] WITH PASSTHROUGH <remotesystem>;
  <MAIN statements>
  <FINALLY statements>


  • identifier - specify a string literal to name the block of queries. This is added to the log. Unnamed blocks are given a unique name.

    • Default: MAIN.
  • PARALLEL - Specify the number of threads the statement can run concurrently in. Default: 1

  • GROUPED - moves specific operations from the MAIN script into pre and post scripts so they can be executed prior to and after (if required) any other operations.

    • All pre-, body, post- and validate step actions contributed by child statements are grouped into their own blocks, replacing the <main statements>.

    • Child blocks are executed serially and have the same PARALLEL and ON ERROR options as the parent.

  • ON ERROR - Error handling inherits from the parent BEGIN blocks if not specified. Default is CANCEL

Option Error in BODY Error in FINALLY
Ignore Error recorded to log, execution continues.  
Cancel Statements following error not executed. Statements following error not executed.
  • MAIN statements - Any valid SQL statements, including BEGIN … END blocks.

  • FINALLY - Additional statements for the script that are run in PRE or BODY statements.