Tag: Recent Questions – Stack Overflow

How to write multi line query in snowflake scripting in stored procedure

create or replace procedure create_src_table() returns table (name varchar, age number(10,0),dob date) language sql as $$ declare create_query varchar; res resultset; begin create_query := `CREATE TEMPORARY TABLE SRC_TEMP_TBL AS SELECT * FROM (WITH CTE_1 AS (SELECT * FROM "DB"."DW"."USER_TBL" WHERE name=’rahul’), CTE_2 AS (SELECT * FROM CTE_1 WHERE CAST(DOB AS DATE)<2000-05-01) SELECT name,age,dob FROM CTE_2 […]