Ashutosh Mishra
Ashutosh Mishra

Reputation: 23

How to call the stored procedure in Snowflake

I want to call the procedure created in main account from a reader account

I have couple of tables shared between them:

  1. Employee
  2. Procedure

Procedure table contains procedure names (to be called in main account) and id.

Calling the procedure as below but unable to do so

set var1 = (select procedure_name from procedure_calls);
call $var1;

Please let me know is it possible to call the way I am calling ?

Upvotes: 1

Views: 4169

Answers (3)

Greg Pavlik
Greg Pavlik

Reputation: 11086

I want to call the procedure created in main account from a reader account

Currently, you can't do this from a reader account. A reader account can run select queries on the tables and secure views its parent account shares to it, and that's all it can do. It can't run other statement types including CALL.

Upvotes: 2

n2pro
n2pro

Reputation: 11

Example - I have a stored procedure

    copy_into_temp_table(table_name VARCHAR)

It can be called via the below statement

 CALL copy_into_temp_table(EMP_TBL);

Upvotes: 0

Felipe Hoffa
Felipe Hoffa

Reputation: 59325

You need to wrap the string with the stored procedure name in a literal identifier():

set sp = 'Load_Employee';

call identifier($sp)()

https://docs.snowflake.com/en/sql-reference/identifier-literal.html

Upvotes: 1

Related Questions