cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to convert SQL Functions to HANA Studio it gives "Scalar UDF does not support SQL statement"

Former Member
0 Kudos

Hi,

I am trying to convert SQL function in HANA Studio. But whenever I execute it gives error "Scalar UDF does not support SQL statement"

Function is :

CREATE FUNCTION "PAYROLLDBTEST".ABS_GetEmployeeHistoryDetails ( EmpID integer)

RETURNS TABLE NVARCHAR(100)

LANGUAGE SQLSCRIPT  

SQL SECURITY INVOKER

    AS

   

    BEGIN SELECT "Code", "Name", "U_LineID", "U_empID", "U_Status", "U_Date" AS "FromDate", ADD_DAYS(

            (SELECT TOP 1 history."U_Date" AS "ToDate"

            FROM "@EMP_HISTORY" history

            WHERE history."U_Date" > "@EMP_HISTORY"."U_Date" AND history."U_empID" = "@EMP_HISTORY"."U_empID"

            ORDER BY history."U_Date"), -1) AS "ToDate", "U_Position", "U_Project", "U_Sponsorship"

        FROM "@EMP_HISTORY"

        WHERE "U_empID" = :EmpID;

    END;

I am not sure if version could be a problem. However HANA version I m using is 1.0.69

Please help, stuck for a long time.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I also encountered the same problem..

former_member188958
Active Contributor
0 Kudos

What does your code look like?

former_member188958
Active Contributor
0 Kudos

I don't have any actual HANA experience yet, but I suspect you need a RETURN keyword between the BEGIN and the SELECT.

-bret