Posts

Showing posts with the label how to Create snowflake stored procedure

Create Snowflake Stored Procedure : Understand Owner and Caller Stored Procedure

Image
Understand Snowflake Stored Procedure   Hello Guys, Currently, there are two languages supported in snowflake to create stored procedure. Javascript SQL and mostly Javascript is used language, lets understand this better. Using $$ as the delimiter makes it easier to write stored procedures that contain single quotes. Please follow the below steps, you would be able to understand  How to create procedure in snowflake? What is owner procedure? and  what is caller procedure? use role sysadmin; --create a table  Create or replace table Colour  (ID int default SEQ_1.nextval, Name varchar(20) null ); --insert few records here  insert into Colour  (Name) values ('Red'), ('Blue'), ('Orange'), ('Pink'), ('Black'), ('White'); --create a owner stored procedure  create or replace procedure Delete_Color_Owner(NAME string) returns float language javascript execute as owner  As $$ var statement = "Delete from snowstages_db.public.colour where Name ...