How to create a procedure in XSJS dynamically in HANA

1.1k Views Asked by At

I have created an application in which I'm calling XSJS file from the browser and in that XSJS file I am calling a normal SQL procedure. In that procedure after some validations I'm calling R procedure. My requirement is to create that R procedure in the user schema when the user calls the XSJS file. And call statement for that R procedure should be updated in SQL procedure. So basically every time a user calls XSJS file the R procedure should be dropped and created again in the user schema. I am using SAP HANA studio latest version.

1

There are 1 best solutions below

0
On

If you want to execute dynamic SQL in SAP HANA, you can use EXECUTE IMMEDIATE SQL command that will work in read and write procedures. You can build SQL query to create a new procedure in xsjs, send this query to a read and write procedure in which you have to use EXECUTE IMMEDIATE QUERY to get your procedure created and same can be done for deletion as well.