我试图从上面的查询在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;
$$;