SnowConvert AI - Sybase IQ - CREATE FUNCTION¶

Description¶

Creates a user-defined function (UDF) that returns a scalar value. SnowConvert AI translates Sybase IQ UDFs to Snowflake UDFs, mapping parameters and data types to Snowflake equivalents.

Note

Sybase IQ supports Transact-SQL as language. For Transact-SQL to Snowflake guidance, see the SQL Server/Azure Synapse translation reference: Built-in Functions. This section documents statement translation specific to Sybase IQ.

Grammar Syntax¶

CREATE FUNCTION [ <owner>. ]<function-name>
   ( <parameter-name> <data-type> [ , ... ] )
RETURNS <return-data-type>
BEGIN
   <function-body>
   RETURN <expression>;
END
Copy

Sample Source Patterns¶

Input Code:¶

Sybase¶

CREATE FUNCTION dbo.fn_tax(p_amount DECIMAL(10,2))
RETURNS DECIMAL(10,2)
BEGIN
    RETURN p_amount * 0.16;
END
Copy

Output Code:¶

Snowflake¶

CREATE OR REPLACE FUNCTION dbo.fn_tax (p_amount DECIMAL(10, 2))
RETURNS DECIMAL(10, 2)
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "sybase",  "convertedOn": "02/02/2026",  "domain": "no-domain-provided",  "migrationid": "GSCcAR8gMXmhqgt7dMJukg==" }}'
AS
$$
  BEGIN
    RETURN p_amount * 0.16;
  END;
$$;
;
Copy

Notes¶

  • Parameter and return data types are translated to their Snowflake equivalents.

  • For procedural logic that cannot be expressed as a SQL UDF, SnowConvert AI may use a JavaScript UDF or recommend a stored procedure.