Typically performs database operations, usually administrative operations like INSERT, UPDATE or DELETE.
Doesn't need to return value.
Supported languages are,
- Snowflake scripting (Snowflake SQL + procedural logic)
- Javascript
- Snowpark API (Python, Scala & Java)
General Syntax:
CREATE PROCEDURE proc_name (table_name varchar ,n1 int)
EXECUTE as caller
RETURN int
LANGUAGE sql
AS
BEGIN
UPDATE IDENTIFIER(:table_name) SET col_name = :n1;
END;
NOTE:
- If argument is used in sql statement to refer to as an object then use IDENTIFIER(:argument)
- If argument is used in sql statement then use :argument
PRIVILEGES:
- Runs either with caller's or owner's rights.
- By default, will run with owner's privileges
No comments:
Post a Comment