User defined functions
This is a translation reference to convert Oracle functions to snowflake.
General Description
Translation
Create Function
CREATE OR REPLACE FUNCTION FUN1(PAR1 VARCHAR)
RETURN VARCHAR
IS
VAR1 VARCHAR(20);
VAR2 VARCHAR(20);
BEGIN
SELECT COL1 INTO VAR1 FROM TABLE1 where col1 = 1;
VAR2 := PAR1 || VAR1;
RETURN VAR2 ;
END;Function inside Package
Return data type mapping
Call
Inside queries
Inside other functions or stored procedures
Different cases and limitations
Functions with DMLs
Functions with only one SELECT INTO
Functions with only logic
Functions with more than one SQL statement
Functions with only logic and built-in SQL functions
RETURN CASE
Last updated
Was this helpful?