Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
How to pass default value to stored proc in snowflake

I am writing a stored proc in Snowflake which have a VARCHAR argument, I would like to know how can I have the default value for that argument.

CREATE OR REPLACE PROCEDURE test(arg1 VARCHAR, arg2 VARCHAR)
returns VARCHAR
language JAVASCRIPT
AS
$$
sql_cmd = snowflake.createStatement ({sqlText:`SELECT * from <table> where ID = ${ARG1};`});
sql_cmd.execute();

$$;

I will call the procedure as :

CALL test (arg1, arg2);

But for arg1 I want to pass default value as 0 (zero) so that if no value is passed, it should accept it as 0(zero).

Couldn't find anything relevant for this, please help.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use overloading - create another procedure with same definition but not arguments. Define default value inside procedure body. Your overloaded procedure will be called in case a call is with no arguments.

CREATE OR REPLACE PROCEDURE test()
returns VARCHAR
language JAVASCRIPT
AS
$$
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!