Skip to main content

All Questions

0 votes
1 answer
61 views

Dynamic SQL and cursor iteration in Snowflake

I've been sitting all weekend, trying to figure out the implementation of cursor iterations in Snowflake procedure blocks. The goal is to create a dynamic procedure that when called checks all ...
Paul's user avatar
  • 15
1 vote
1 answer
53 views

Snowflake SQL stored procedure not working

I am trying to create a SQL stored procedure in Snowflake (Snowsight), but it is throwing run-time error. Not able to identify what the issue is. I am getting thius error : invalid identifier '...
Jayanta Paul's user avatar
0 votes
1 answer
46 views

Unknown syntax error with Snowflake SQL procedure

I am writing a Snowflake SQL procedure to drop row access and masking policies from a database once it is cloned. CREATE or REPLACE PROCEDURE DBMGT.DBADMIN.Q_DROP_MASKING_and_ROP_ON_BKP_DB("...
madrarua's user avatar
-1 votes
0 answers
25 views

Rolling x weeks in a table

Need to create a table with above 200M records using multiple underlying tables and couple views and lot of joins etc. It is based on one main underlying fact table that has a date stamp (updates ...
Feel's user avatar
  • 3
0 votes
1 answer
93 views

Stored Procedure: add parameter for month or hour

I have the below Stored Procedure on Snowflake that sends out an email with all the load errors that exist in table SNOWFLAKE.ACCOUNT_USAGE.COPY_HISTORY for the last 24 hours. This is working ok but ...
Estrobelai's user avatar
0 votes
2 answers
78 views

Loop through all stages in schema within a stored procedure and pass them on as arguments

I am trying to tweak my stored procedure in Snowflake so that I can loop through all external stages (in S3) from my schema manual_adjustments and not have to call this other procedure CHECK_LOAD() ...
Estrobelai's user avatar
0 votes
0 answers
44 views

Snowflake - dynamic "copy into" across different stages

I am trying to create a procedure in Snowflake that will dynamically copy files from different external stages in S3 into a table. Please see the procedure below: CREATE OR REPLACE PROCEDURE ...
Estrobelai's user avatar
0 votes
1 answer
65 views

How to use the value from a result set within a for loop in Snowflake stored procedure?

I am trying to run a data reconciliation stored procedure on each user that exists in the source table. To do this, I retrieve all distinct user IDs in that table and then run the procedure for each ...
tim_cashion's user avatar
0 votes
1 answer
29 views

Snowflake stored procedure passing parameter

I am trying to call a stored procedure in Snowflake and getting the following error message invalid identifier 'ID_1PAR' (line 2) I created the following stored procedure, and expecting the ...
joseph madrinkian's user avatar
0 votes
2 answers
59 views

Not able to set the variable as column alias in create view in snowflake stored procedure

I am trying to create a view in snowflake stored procedure. I need one of the column from the variable. I tried following but getting following error, Error SQL compilation error: syntax error line 4 ...
Yasin's user avatar
  • 1
0 votes
1 answer
45 views

Snowflake - Procedure is created but fails when executed

I have a stored procedure that is pretty long but the next one i think reflects what it does: CREATE OR REPLACE PROCEDURE db.schema.sp_1( param_col_1 VARCHAR, param_col_2 VARCHAR, ...
Robertino Bonora's user avatar
0 votes
0 answers
55 views

Snowflake SQL Procedure CALL using OBJECT CONSTRUCT

I'm trying to create a snowflake procedure in SQL which takes two inputs (first is table_name and second is object where key is column_name and value is 1,2,3 etc.,). When the value is 1, then it ...
Pandit Abilash's user avatar
0 votes
1 answer
40 views

Snowflake SQL to Create Roles and SQL Statements. , facing unexpected <EOF> or unexpected 'END'

We intend to dynamically create roles based on SF metadata. Preferably through a Stored Procedure. However, we are struggling to debug and spend way too much time investigating error codes that SF ...
user24892220's user avatar
1 vote
1 answer
105 views

In Snowflake, Best Practice of using : LAST_QUERY_ID() vs. Cursors for Capturing intermediate result in Snowflake Stored Procedures

I'm relatively new to Snowflake and currently working with stored procedures in SQL. In my procedures, I dynamically execute insert and update queries using EXECUTE IMMEDIATE :InsertSQL. To capture ...
Tharun's user avatar
  • 11
0 votes
0 answers
31 views

Not able to run Snowflake procedures parallelly in same time without waiting for one to complete

I am working with procedures and wanted to run multiple procedures in same time and don't want to wait for one to complete ------ My procedure CREATE OR REPLACE PROCEDURE RUNFORMINUTE() RETURNS ...
Ajay's user avatar
  • 1

15 30 50 per page
1
2 3 4 5
26