Wednesday, November 18, 2015

Calling procedure by using $.hdb




The following example of usage of the SAP HANA XS database API shows how to establish a connection withSAP HANA and return a result set from the specified procedure call.
The example code assumes that a procedure exists with the following signature:

CREATE PROCEDURE "DRACE".USP_TBLUSERS_INSERT(
     IN flavor VARCHAR, 
     IN quantity INTEGER,    
     OUT change DECIMAL)


Syntax: 

var data=[];

//if you don't have sqlcc file for your package, make sure getConnection method properties are empty
//ex:    var conn=$.hdb.getConnection();

 var conn=$.hdb.getConnection({ "sqlcc": "packagename::sqlccfilename"});

var pstm= conn.loadProcedure('Schemaname', 'Procedure Name'); 
var result = pstm(input1, input2);

   data.push({
         
           "status": result[output variable name]
        })
        conn.commit();
      

No comments:

Post a Comment