I am trying to sue Snowflake Scripting to run an insert statement. I can get it to return a value from a query but not run the statement.
create or replace table ccb_test as
select
1 as value,
sysdate() as ETL_TS;
SET reload_type = 'PARTIAL'
BEGIN
LET reload := $reload_type;
IF (reload = 'PARTIAL') THEN
RETURN ( INSERT into ccb_test select 2 as value, sysdate() as ETL_DATE);
ELSE
RETURN (SELECT 'Reload is set to FULL, no merge action needed.' AS message);
END IF;
END;
I have tried multiple versions of this but only get it to run if I query a statement with one returned value but not an update, insert, or create statement
BEGIN
LET reload := $reload_type;
IF (reload = 'PARTIAL') THEN
RETURN (SELECT 'Reload is set to PARTIAL, merging.' AS message);
ELSE
RETURN (SELECT 'Reload is set to FULL, no merge action needed.' AS message);
END IF;
END;
New contributor
user24904733 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.