是否有任何方法可以在snowflake/sql中存储上述查询(类似于@@rowcount)中的rowcount ?<



我试图从上面的查询在snowflake sql变量行计数。

有一个全局变量SQLROWCOUNT来存储这些信息。

查看这些链接:

确定受DML命令影响的行数

用Snowflake脚本编写存储过程

示例代码:

execute immediate $$
begin
-- Insert 3 rows into a table.
insert into my_values values (1), (2), (3);
-- SQLROWCOUNT is not affected by statements
-- that are not DML statements (e.g. SELECT statements).
select * from my_values;
-- Returns the number of rows affected by
-- the last DML statement (the INSERT statement).
return sqlrowcount;
end;
$$;