Closed DOVER123 closed 4 years ago
Yes.
Is the statement the same for each insert, just the values going in are different?
i try connection.excutemany
What did you try? Why don't you show us?
but it can't work
Did you get an error? Why don't you show us?
yes,just the value different。i used it like this;
var sql ="insert into xxx values(xxxx); insert into xxx values(xxxx); insert into xxx values(xxxx); insert into xxx values(xxxx);" connection.excuteMany(sql)
i think i konw where i was wrong, I should use it like "insert into xxx values(:a)" and make a binds for it,connection.excuteMany(sql,binds),now it worked。
then i have another question 。
i have a sql like this "insert into xxxTable select "A","B","C“ from dual"
xxxTable have three fields。
i use connection.excuteMany("insert into xxxTable select :key from dual",[{key:"A,B,C"},{key:"D,E,F"}]),
then i got a error :Ora-00947: not enough values
i use connection.excuteMany("insert into xxxTable select :key from dual",[{key:"A,B,C"},{key:"D,E,F"}]),
Each bind is a single value. key
is a single bind. Its value is the string "A,B,C".
But really, why would you do this select from dual
anyway? It's not needed.
@dmcghan hahah i see,DBA just give it to me ,I supposed it would be ok. now i know,i will not use it again thank you very much
Here is documentation on executeMany()
: https://oracle.github.io/node-oracledb/doc/api.html#batchexecution
The IN bind doc for execute()
may also be useful: https://oracle.github.io/node-oracledb/doc/api.html#inbind
i have many insert sql like var sql=
insert into xxx values(xxxx); insert into xxx values(xxxx); insert into xxx values(xxxx); insert into xxx values(xxxx);
i try connection.excutemany but it can't work,should i use connectoin.excute() and excute it one by one?