X

@OracleIMC Partner Resources & Training: Discover your Modernization options + Reach new potential through Innovation

ORA-01036 Error in Node.js app with Oracle Database Node.js Add-on

Guest Author

Recently I’ve
experimented with Node.js REST application using node-oracledb add-on and
tried to deploy it to Oracle Application
Container Cloud Service
(AcCS). I’ve encountered with issue, that very
simple query without any bind variables raised an ORA-01036: Illegal variable name/number error:

...

connection.execute("SELECT id, title
FROM topics",

{ outFormat: oracledb.OBJECT },

function (err, result) {

...

});

...

Solution of
this problem turned out do not be very obvious. Even if there are no bind
variables in the SQL statement, anyway you must specify a null bindParams param, for example
{}, otherwise you will get an error
like ORA-01036: Illegal variable
name/number
or NJS-012: encountered
invalid bind datatype
. So if you change the code with
{} bindVariable param value in execute
method then you code will be executed without errors:

...

connection.execute("SELECT id, title
FROM topics", {},

{ outFormat: oracledb.OBJECT },

function (err, result) {

...

});

...


Please
check the node-oracledb
documentation
for additional details.

Finally
if you are going to deploy your app to Oracle AcCS, note that you do not need to add node-oracledb add-on in your application zip archive.

Happy
coding!
J

Join the discussion

Comments ( 1 )
  • ralbritton Thursday, August 23, 2018
    Thank you - this was exactly what my issue was.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services