1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Additional new lines in SQL script file and problem with SQL*Plus

Discussion in 'SQL PL/SQL' started by dariyoosh, Nov 22, 2009.

  1. dariyoosh

    dariyoosh Forum Advisor

    Messages:
    118
    Likes Received:
    19
    Trophy Points:
    260
    Dear all,


    I would like to ask a question about new line characters inside SQL file scripts. I have a very long SQL query saved in a txt file (ANSI coding). Because the query statements are very long (many table joins and WHERE conditions) I tried to separate the FROM, WHERE and ORDER BY clauses by inserting several new line characters (just hitting the Enter) among them to improve the clarity of the source code. Now the problem is, whenever these new line characters are inserted into the file, apparently SQL*Plus can no more parse the file properly and gives me the following error message:

    Code (Text):

    SP2-0042: unknown command "FROM" - rest of line ignored.
    SP2-0734: unknown command beginning "myenterpri..." - rest of line ignored.
     
    The problem is definitely related to these new line characters because when I remove them, the scripts runs without any problem. I would appreciate if you could kindly guide me how should I deal with this problem. Is there any SQL*Plus command to run in order to interpret new line characters correctly?


    Thanks in advance,


    Kind Regards,
    Dariyoosh
     
  2. dariyoosh

    dariyoosh Forum Advisor

    Messages:
    118
    Likes Received:
    19
    Trophy Points:
    260
    Ok, I found the answer myself.


    What I had to do was to add this at the first line of the script file:

    Code (Text):

    SET    SQLBLANKLINES   ON
     

    Kind Regards,
    Dariyoosh
    :D