Comment
06-28-2024
12:27 PM
06-28-2024
12:27 PM
Thanks for posting this, it's quite useful!
I am having trouble using the INTO command to assign the result of the query into a variable. This is only happening on SQL Serverless, while using all-purpose compute (DBR 14.3 LTS) works.
Code sample:
DECLARE OR REPLACE sum INT;
DECLARE OR REPLACE sqlStr = 'SELECT 10';
EXECUTE IMMEDIATE sqlStr INTO sum;
SELECT sum;Running this on all-purpose compute I get the correct output of 10:
Running it on SQL Serverless, the value of sum is null:
This was run on a SQL notebook, but same issue happens when running in SQL Editor:
Any idea why this is happening?
Thanks!