Working with Optional Arguments
When a Snowflake stored procedure includes optional arguments, those arguments appear in the Stored Procedure executor.
When you want to define an optional argument, you must define all arguments, required and optional, that are listed before the optional argument.
For example, say you create a Stored Procedure executor based on a stored procedure that includes
one required argument and three optional arguments as
follows:
CREATE OR REPLACE PROCEDURE REVIEW_PROCESSING(
review VARCHAR,
review_summary VARCHAR DEFAULT 'none',
review_sentiment VARCHAR DEFAULT 'none',
rating NUMBER(38,0) DEFAULT 0))
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS OWNER
AS
BEGIN
...
END;
If you want to define the required review
argument and the optional
review_sentiment
argument, you must also define the optional
review_summary
argument.
In the executor, this means that you define the first three arguments. You also remove the last
argument, which represents the optional rating
argument.