I actually created a similar function with the same logic and this is the sql
CREATE FUNCTION "PTIRUCHANUR"."ufnGetCustomerInformation" (customerid int)
RETURNS table ("CUSTOMERID" INT,
"FIRSTNAME" NVARCHAR(30) ,
"LASTNAME" NVARCHAR(30)
) LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER AS
BEGIN
RETURN SELECT
"CUSTOMERID",
"FIRSTNAME",
"LASTNAME"
FROM "PTIRUCHANUR"."CUSTOMER"
WHERE "CUSTOMERID" = :customerid;
END;
This function works when I do a select statement.
Also I created a another function which is giving me the same error as my question and the sql is as follows.
CREATEFUNCTION"HALLE"."UFNGETSALESORDERSTATUSTEXT_TEST"(status tinyint)
RETURNS TABLE("RET"nvarchar(15))
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER AS
-- Returns the sales order status text representation for the status value.
BEGIN
DECLARE"RET"nvarchar(15);
RETURN SELECT
CASE status
WHEN 1 THEN'In process'
WHEN 2 THEN'Approved'
WHEN 3 THEN'Backordered'
WHEN 4 THEN'Rejected'
WHEN 5 THEN'Shipped'
WHEN 6 THEN'Cancelled'
ELSE'** Invalid **'
END
AS"RET"
FROM DUMMY;
END;
the function executed correctly however the select statement is throwing the error referred in my original question