Before writing a CREATE PROCEDURE statement:
- Read
references/parameters.mdto review all available parameters and their defaults. - For each parameter, decide whether the user's request implies a non-default value.
- Include only the parameters that differ from the default or that the user explicitly requested.
- Never use
CREATE OR REPLACE— always useCREATE PROCEDURE IF NOT EXISTSwhere supported. - Confirm the handler language (SQL/Snowflake Scripting, JavaScript, Python, Java, or Scala) before generating code; each language has distinct required parameters (
RUNTIME_VERSION,PACKAGES,HANDLER). - Default execution context is
EXECUTE AS OWNER; switch toEXECUTE AS CALLERonly when the procedure must run with the caller's privileges. - Stored procedures support overloading by argument count or data types; ensure the signature is unambiguous.
- Procedures are not atomic — individual statement failures do not automatically roll back the entire procedure; advise explicit transaction control when needed.