DROPs
Translation reference to convert SQL Server DROP FUNCTION and DROP PROCEDURE to Snowflake Scripting
Last updated
Translation reference to convert SQL Server DROP FUNCTION and DROP PROCEDURE to Snowflake Scripting
Last updated
To drop a procedure or function in Snowflake SQL it is necessary to specify the parameters types in the drop statement, which is the main difference with SQL Server. In this translation, IF EXISTS clause is added by default to avoid runtime errors in Snowflake SQL.
The following examples details the drop routine statement for procedures and functions.
CREATE PROCEDURE SOMEPROCEDURE()
AS
BEGIN
DROP FUNCTION SOMEFUNCTIONTODROP;
DROP PROCEDURE IF EXISTS SOMEPROCEDURETODROP;
END;
CREATE OR REPLACE PROCEDURE SOMEPROCEDURE ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"transact"}}'
EXECUTE AS CALLER
AS
$$
BEGIN
DROP FUNCTION IF EXISTS SOMEFUNCTIONTODROP ();
DROP PROCEDURE IF EXISTS SOMEPROCEDURETODROP ();
END;
$$;
No issues were found.
SSC-EWI-0073: Pending Functional Equivalence Review.