Snowflake Scripting: Changes to global variables¶
Attention
This behavior change is in the 2025_01 bundle.
For the current status of the bundle, refer to Bundle History.
When this behavior change bundle is enabled, the Snowflake Scripting global variables for DML commands behave differently. These variables are described in Determining the number of rows affected by DML commands.
When a non-DML statement is executed after the last DML statement in a Snowflake Scripting block or stored procedure, these variables behave as follows:
- Before the change:
The variables return the value set by the last DML statement:
SQLROWCOUNT- Number of rows affected by the last DML statement.SQLFOUND-TRUEorFALSEbased on the last DML statement.SQLNOTFOUND-TRUEorFALSEbased on the last DML statement.
- After the change:
The variables return NULL.
For example, the following Snowflake Scripting anonymous block returns different values before and after the change:
- Returned value before the change::
- Returned value after the change::
To achieve the previous behavior after the change, save the Snowflake Scripting global variable value in a new variable before subsequent non-DML statements, and then return the value of the new variable. For example:
Ref: 1850