cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP SQL Script(Table Function) Script error

praveen_kumar334
Participant
0 Likes
707

Hi Team,

While creating SQL View with SQLScript(Table Function), I am getting the below error. Could someone please help me in fixing this error.

View Entire Topic
XaviPolo
Active Contributor

DSP already includes automatically some parts of the function that you don't have to write in the SQL Script, such as the definition of the table it returns, the parameters or the BEGIN/END that encompasses the whole function.

Apart from that, it is already a normal function, you can put the variable DECLARES at the top, use conditionals, etc.

Something that in HANA is:

FUNCTION "XP"."TF_SAMPLE_SUM" ( IP_A INT, IP_B INT) 
  RETURNS TABLE
    (
      RESULT INT
    )
  LANGUAGE SQLSCRIPT
  SQL SECURITY INVOKER AS
BEGIN
  DECLARE TMP_VAR INT = 10;
  RETURN SELECT (:IP_A + :IP_B) * :TMP_VAR AS "RESULT" FROM DUMMY;
END;

In DSP is:

DECLARE TMP_VAR INT = 10;
RETURN SELECT (:IP_A + :IP_B) * :TMP_VAR AS "RESULT" FROM DUMMY;

The table definition and parameters are defined in the graphical interface, not in the code.

Regards,