0

I can't figure out Snowflake variables. I have:

Declare
max_count integer default 100;
product varchar default null;

BEGIN
for i in 1 to max_count
do
let product = (select product from mytable where id = :i);
insert into new_table select revenue from rev_table where product = $product;
end for;
end;

Maybe I should use a cursor but in my example -- the :i -- is always resolving to 1. I don't really get it.

I want to use an incrementing variable here.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.