Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query.whereIn on Oracle report ORA-32109: invalid column or parameter position #87

Open
mspellecacy opened this issue Aug 20, 2013 · 0 comments

Comments

@mspellecacy
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant