如何在节点js中处理oracle.sql.ARRAY?

我正在尝试使用节点oracle驱动程序调用Oracle存储过程 – https://github.com/joeferner/node-oracle

我能够使用下面的代码调用过程,但是我有第二个参数(parameterArray)的问题。 它需要一个项目的数组传递给它,在Java中我们使用oracle.sql.ARRAY,但我将如何处理这与节点js? 我现在的代码如下…

var oracle = require('oracle'); var connectData = { hostname: "example_editted.com", port: 1521, database: "dev", // System ID (SID) user: "user", password: "password" } oracle.connect(connectData, function(err, connection) { var starting_time = req.body.startDate + " 00:00:00" var ending_time = req.body.endDate +" 00:00:00" var parameterArray = {owner_id: req.body.accountId, time_min: null, time_max: null, duration_min: null, duration_max: null, date_format: "'MM/DD/YYYY HH24:MI:SS'", start_date: starting_time, end_date: ending_time} connection.execute("call reporting.execute_report(:1, :2, :3)", ["ProcedureName", parameterArray,new oracle.OutParam()], function(err, results) { 

目前我得到的错误是

 Assertion failed: (handle->InternalFieldCount() > 0), function Unwrap, file /Users/johnson/.node-gyp/0.10.35/src/node_object_wrap.h, line 61. Abort trap: 6 

根据纯粹的猜测 ,问题可能在于OCI无法绑定string索引集合,您的解决scheme可能是在调用存储过程并在PLSQL代码中重新组合关联集合之前,将您的JS对象分解为一对常规数组在调用存储过程之前,即…

 . . . //var parameterArray = {owner_id: req.body.accountId, time_min: null, time_max: null, duration_min: null, duration_max: null, date_format: "'MM/DD/YYYY HH24:MI:SS'", start_date: starting_time, end_date: ending_time} var parameterArrayIndices = ["owner_id", "time_min", "time_max", "duration_min", "duration_max", "date_format", "start_date", "end_date"]; var parameterArrayValues = [req.body.accountId, null, null, null, null, "'MM/DD/YYYY HH24:MI:SS'", starting_time, ending_time]; connection.execute(" declare i_indices dbms_sql.varchar2a; i_values dbms_sql.varchar2a; l_params <the_collection_type_of_the_procedure's_second_parameter>; begin i_indices := :1; i_values := :2; for i in nvl(i_indices.first,1)..nvl(i_indices.last,0) loop l_params(i_indices(i)) := i_values(i); end loop; reporting.execute_report(:3, l_params, :4); end; ", [parameterArrayIndices, parameterArrayValues, "ProcedureName", new oracle.OutParam()], function(err, results) {