Im using node-oracledb driver in my nodeJs application. I am having to do bulk inserts (upto 6000 rows) and the batch insert feature of simple-oracledb extension did not meet my needs. It is painfully slow for 6000 records. I came across this post and this doc from node-oracledb however and it seems like a promising way. It's just that im new to PL/SQL that Im not understanding how to do it.
So consider I have the following table:
CREATE TABLE MY_TABLE 
( "CID" NUMBER,
"EMPID" VARCHAR2(10 BYTE));
I have 3 records for bulk insertion. Here is my PL/SQL package:
CREATE OR REPLACE PACKAGE MY_PKG IS
  TYPE cidtype IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
  TYPE empidtype IS TABLE OF VARCHAR2(10);
  PROCEDURE insertproc(cids IN cidtype, empids IN empidtype);
END;
/
CREATE OR REPLACE PACKAGE BODY MY_PKG IS
  PROCEDURE insertproc(cids IN cidtype, empids IN empidtype) IS
  BEGIN
    FORALL i IN INDICES OF cids
      INSERT INTO MY_TABLE (cid, empid) VALUES (cids(i), empids(i));
  END;
END;
/
My NodeJS code:
var stmt = `BEGIN MY_PKG.insertproc(:cids, :empids); END;`;
var params = {
    cids: {
        type: oracledb.NUMBER,
        dir: oracledb.BIND_IN,
        val: [100, 101, 102]
    },
    empids: {
        type: oracledb.STRING,
        dir: oracledb.BIND_IN,
        val: ['ab165634', 'df123456', 'cd456789']
    }
};
connection.execute(stmt,params,function (err) { . . . });
However this throws the following error:
ORA-06550: line 1, column 7:\nPLS-00306: wrong number or types of arguments in call to 'INSERTPROC'\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored\n
Since the example only show how u can bind array for 1 column, I couldnt figure out how its done for multiple columns (the entire row). Any help would be greatly appreciated!!!
 
     
     
    