node-persist
node-persist copied to clipboard
Query.whereIn on Oracle report ORA-32109: invalid column or parameter position
Trace returns the generated query as:
select t0.processor_code AS c0, t0.processor_type_code AS c1, t0.processor AS c2, t0.year AS c3, t0.address AS c4, t0.city AS c5, t0.state AS c6, t0.zip_code AS c7, t0.contact_name AS c8, t0.phone_1 AS c9, t0.phone_2 AS c10, t0.comments AS c11 FROM data.processor t0
WHERE t0.processor_code IN (:1,?,?,?,?,?,?,?,?)
[ 'C2971', 'C5341', 'C6687', 'C67309', 'C8500', 'F0133', 'F4449', 'F8162', 'TP9580' ]
Oracle Returns the error:
[Error: ORA-32109: invalid column or parameter position]
If I take the generated query and make:
select t0.processor_code AS c0, t0.processor_type_code AS c1, t0.processor AS c2, t0.year AS c3, t0.address AS c4, t0.city AS c5, t0.state AS c6, t0.zip_code AS c7, t0.contact_name AS c8, t0.phone_1 AS c9, t0.phone_2 AS c10, t0.comments AS c11 FROM data.processor t0 WHERE t0.processor_code IN ('C2971',
'C5341', 'C6687', 'C67309', 'C8500', 'F0133', 'F4449', 'F8162', 'TP9580' );
Everything returns fine.
Here is the code making the call:
exports.processors = function (req, res, next) {
persist.connect(function (err, conn) {
if(err) { console.log(err); } else { console.log("DB Connected"); }
ProcessorAreaContext.where({managementCode:req.params.unitCode}).all(conn, function (err, pacs){
if(err) { console.log(err); }
Processor.whereIn('processorCode', _.pluck(pacs,'processorCode')).all(conn, function (err, procs) {
if(err) { console.log(err); }
res.end();
//res.json(procs);
});
});
});
};
I can probably hack out a workaround, but it seems like this code should work according to the docs?