cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Script Library

chinabba_lc
Explorer
0 Kudos

Hi All,

I am trying to create a User-Defined SQL Script Library in HANA version 2.00.031.00.. Here are I am getting following error.

Could you please assist me?

Could not execute 'LIBRARY "MasterData" LANGUAGE SQLSCRIPT AS BEGIN Public variable vrowcount int'
SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "LIBRARY": line 1 col 1 (at pos 1)
LIBRARY "MasterData"
 LANGUAGE SQLSCRIPT AS
 BEGIN
   Public variable vrowcount int;
   
   Public Function "prod_exists" (in ip_prod_id nvarchar(10))
          Returns Res Boolean as
          Begin
           Declare lv_cnt int;
           
             Select count (*) Into cnt from "CHINABBAS"."PRODUCT_DETAILS"
              WHERE  "PRODUCT_ID" = :ip_prod_id;
              
              If lv_cnt > 0 THEN
                Res := true;
              Else
                Res := false;
              END IF;
                
          End;
          
    Public Procedure "get_prod_data"   (OUT o_tb_prod "CHINABBAS"."PRODUCT_DETAILS")
     LANGUAGE SQLSCRIPT
     SQL Security Invoker
     AS
     BEGIN
       o_tb_prod = Select * FROM "CHINABBAS"."PRODUCT_DETAILS";
       vrowcount = record_count (:o_tb_prod);
     END;


END;


Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor
0 Kudos

The statement is not just "LIBRARY", it is "CREATE LIBRARY". Please check the examples here.

chinabba_lc
Explorer
0 Kudos

Thank you. Is there any possibility to see already existing libraries in HANA Studio?

pfefferf
Active Contributor
0 Kudos

You can get some information from the system views mentioned here. In the DEFINITION columns of the views you can see the CREATE LIBRARY statement respectively the FUNCTION/PROCEDURE headers.

Answers (0)