ACTIVITY_COUNT
Translation specification for the ACTIVITY_COUNT status variable.
Description
The ACTIVITY_COUNT status variable returns the number of rows affected by an SQL DML statement in an embedded SQL or stored procedure application. For more information check here.
There is no direct equivalent in Snowflake. However, there is a workaround to emulate the ACTIVITY_COUNT's behavior. One must simply use the following query:
SELECT $1 FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));This query retrieves and returns the first column of the result set from the last executed query in the current session. Furthermore, $1 can be replaced by "number of rows inserted", "number of rows updated" or "number of rows deleted" based on the query type.
As expected, this translation behaves like its Teradata counterpart only when no other queries besides the SQL DML statement are executed before calling LAST_QUERY_ID.
Sample Source Patterns
Setup data
Teradata
Snowflake
Supported usage
Teradata
Snowflake
Known Issues
If
ACTIVITY_COUNTis called twice or more times before executing a DML statement, the transformation might not return the expected values. Check here.If
ACTIVITY_COUNTis called after a non DML statement was executed, the transformation will not return the expected values. Check here.ACTIVITY_COUNTrequires manual fixing when inside aSELECT/SET INTO VARIABLEstatement and was not able to be identified as a column name. Check here.
Related EWIs
SSC-FDM-TD0033: 'ACTIVITY_COUNT' TRANSFORMATION MIGHT REQUIRE MANUAL ADJUSTMENTS.
Last updated
