When I launch the following task .cmd :
sqlplus -s User/Password@database @Query.sql 'G:'
I get this error :
SP2-0734: unknown command beginnin
Even adding set sqlblanklines on
it failed.
With a simple query like select * from table1
it works.
With a more complex query ( multiple join, group by) it does not work => Even if the file is well generated. Inside the file, I just find errors details.
Please find below more details about the issue :
SP2-0734: unknown command beginning "FROM NOTI...." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "LEFT JOIN ..." - rest of line ignored.
SP2-0734: unknown command beginning "LEFT join ..." - rest of line ignored.
SP2-0734: unknown command beginning "LEFT join ..." - rest of line ignored.
SP2-0734: unknown command beginning "LEFT JOIN ..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "LEFT join ..." - rest of line ignored.
SP2-0734: unknown command beginning "LEFT join ..." - rest of line ignored.
SP2-0734: unknown command beginning "WHERE NOTI..." - rest of line ignored.
SP2-0734: unknown command beginning "GROUP BY N..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning ",table1..." - rest of line ignored.
SP2-0734: unknown command beginning ",table2..." - rest of line ignored.
By default SQL*Plus treats a blank line as terminating the previous command:
A blank line in a SQL statement or script tells SQL*Plus that you have finished entering the command, but do not want to run it yet.
The first blank line, before the FROM
, terminates the SELECT
- but it is not executed since the last line does not have a semicolon on the end and you don't have a /
on the next line. That partial SELECT
is held in the statement buffer but is never executed.
SQL*Plus then tries to interpret the rest of the file, but as each subsequent line doesn't start with something it recognises as SQL, and isn't a SQL*Plus command, you get SP2-0044 for all of them.
You can either remove the blank lines in the middle of the statement; or issue SET SQLBLANKLINES ON
at the start of your script:
Controls whether SQL*Plus puts blank lines within a SQL command or script. ON interprets blank lines and new lines as part of a SQL command or script. OFF, the default value, does not allow blank lines or new lines in a SQL command or script or script.
I got the same issue even i tried SET SQLBLANKLINES ON but no luck. I finally figured out the issue was with file encoding format. Actually I used to save my sql file using visual studio, which saves the file in utf-8 encoding format.
solution- open sql file in notepad -> save as ANSI encoding format. it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With