Skip to content

Oracle SQL command not properly ended while running a subquery through Node.js

I am trying to fetch all the columns present in a table with this subquery

I am calling my code with these parameters

here is my code

this code works fine when I call it

like this

but it is giving this error when I execute the 1st query

Advertisement

Answer

As mentioned by @alex-poole in a comment, the issue (or first issue) will be that you have a trailing semi-colon in the statement:

Change it to:

Oracle SQL doesn’t include semi-colons. Confusingly, semi-colons are needed for PL/SQL, and are also used for SQL by some tools like SQL*Plus to say “this is the end of the statement, execute everything before here”.

A (potential) second issue is that you are not using bind variables. You probably want to do:

Bind variables improve scalability and help prevent SQL Injection security problems.

User contributions licensed under: CC BY-SA
8 People found this is helpful