Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Call stored procedure from server side javascript

$
0
0

Hi there,

 

I'm using the following server side js to call a procedure from an xs-appication:

 

var body = '';

var conn = $.db.getConnection();

var cst = conn.prepareCall('{CALL mypk.TESTPROCEDURE(?,?)}');

cst.setInt(1,4711);

if (cst.execute()) {

    body = 'Ok'  + cst.getInteger(3);

} else {

    body = 'Failed';

}

 

The procedure looks like this:

 

create procedure mypk.TESTPROCEDURE(in factor1 int, out res int) language sqlscript as

begin

    INSERT INTO "mypk"."TESTTABLE" (SOMEFIELD) VALUES ('1234');

     res := :factor1 + 1000;

end;

 

The procedure gets executed well and the result value is OK, but the INSERT-statement within the proecdure doesn't get executed (or at least no insert in the TESTTABLE is done).

 

When the procedure is called from an SQL-window the insert is ok.

What could be wrong here?

Thanks!


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>