我正试图使用以下代码从服务端调用SAP HANA hdbpprocedure。
var con = ConLib.getHDBConnection();
var uploadStmt = con.loadProcedure("_SYS_BIC" , "procname");
var result = uploadStmt("samplefield1", "samplefield2", {"DATA":[{"id1":"id_1001","id2":"id_2001","year_col":"2018"}, {"id1":"id_1002","id2":"id_2002","year_col":"2019"}]})
该过程采用以下参数作为输入。
PROCEDURE procname (
IN field1 VARCHAR(100),
IN field2 VARCHAR(100)
IN in_table_data "schema_name"."hdbdd_file_name.table_type"
){}
in_table_data在hdbdd_file_name.hdbdd文件中定义如下。
Type table_type {
id1 : String(100);
id2 : String(100);
year_col : String(4);}
当我从服务端调用该过程时,我得到了以下错误。
" Error occured in processRequest method $.hdb.Connection.executeProcedure: Parameter at position 3 is not of type that can be processed "
你能建议在数据库端或服务端需要更改什么来解决这个问题吗。
提前谢谢。
我认为您的调用语句中的数组定义是不正确的:
var result = uploadStmt("samplefield1", "samplefield2", {"DATA":[{"id1":"id_1001","id2":"id_2001","year_col":"2018"}, {"id1":"id_1002","id2":"id_2002","year_col":"2019"}]})
相反,可以这样尝试:
var result = uploadStmt("samplefield1"
, "samplefield2"
, [{id1: 'id_1001', id2: 'id_2001', year_col: '2018'}
, {id1: 'id_1002', id2: 'id_2002', year_col: '2019'}]
)