Hello,
--High Priority--
We are experiencing a strange behaviour with our HANA instance. We are trying to build a simple linear regression model to show demo on HANA PAL capabilities. For this we are following HANA academy and developer guides.
Situation:
We have built an SAPUI5 frontend where an user can simulate the prices and see the impact on sales and so on. So, for every value of purchase price changed on UI by the user will trigger an "XSJS" call to the backend to execute the procedures an send back the results from tables back to the UI.
Example Code:
Currently we have an "xsjs" script that keeps running forever. I tried to debug each line of the script and found out that the ".execute()" function never ends.The code is as follows:
function procExecute(proc) { var body; var conn; $.response.status = $.net.http.OK; try { conn = $.db.getConnection(); var price = $.request.parameters.get('PURPRICE'); var pStmt = conn.prepareCall(proc); pStmt.setFloat(1, parseFloat(price)); var rs = pStmt.execute(); //the execution never ends in here conn.commit(); $.response.status = $.net.http.OK; } catch (e) { body = "Error generated"; $.response.status = $.net.http.BAD_REQUEST; } conn.close(); } procExecute('call "_SYS_BIC"."path1.path2/gen_proc_purchase_to_sales_pred_values_gen1"(?)');
Procedure to be called:
create procedure _SYS_BIC.gen_proc_purchase_to_sales_pred_values_gen1( in PURPRICE DECIMAL(11,4) ) language SQLSCRIPT sql security invoker as BEGIN DECLARE PURPRICE1 DOUBLE := :PURPRICE ; DECLARE id_val INTEGER; EXEC 'SET SCHEMA APP_TEST'; EXEC 'DROP TABLE APP_TEST.PS_RGP_PREDICT'; EXEC 'DROP TABLE APP_TEST.PS_RGP_PREDICTED'; CREATE COLUMN TABLE APP_TEST.PS_RGP_PREDICT ("ID" INT,"PurchasePrice" DOUBLE); CREATE COLUMN TABLE APP_TEST.PS_RGP_PREDICTED(ID INT,Fitted DOUBLE); DELETE FROM APP_TEST.PS_RGP_PREDICT; select max(ID)+1 into id_val from APP_TEST.V_PS_RG_DATA; EXEC 'COMMIT'; INSERT INTO APP_TEST.PS_RGP_PREDICT values(:id_val,:PURPRICE1); DELETE FROM APP_TEST.PS_RGP_PREDICTED; PS_RGP_PREDICT_TBL = SELECT * FROM APP_TEST.PS_RGP_PREDICT; PS_RG_COEFF_TBL = SELECT * FROM APP_TEST.PS_RG_COEFF; PS_RG_PARAMS_TBL = SELECT * FROM APP_TEST.PS_RG_PARAMS; CALL _SYS_AFL.PAL_PS_RGP1(:PS_RGP_PREDICT_TBL, :PS_RG_COEFF_TBL, :PS_RG_PARAMS_TBL, :lv_ps_rgp_predicted_tbl) WITH OVERVIEW; INSERT INTO APP_TEST.PS_RGP_PREDICTED SELECT * FROM :lv_ps_rgp_predicted_tbl; END;
Note: We have put initial part of the code onto other procedures for preparing data and generating statistic values (similar to what we HANA PAL developer guide).
When we execute the procedure with a value manually on SQL console, it runs fine and the predicted values are generated. But when called with XSJS, the execution fails. Once the execution fails, we are not able to execute the procedure via SQL console as well.
We do have several xsjs files that calls procedures for other applcaitions and they work absolutely fine.
Can any one suggest some ideas to fix the above?
Thanks in advance.