Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    9

    Unanswered: Echo for SQL scripts

    Hi all,

    I want to see input SQL statements in the log file when I run the script in SQLPlus. I have used this set command "SET ECHO ON" for this. However, the log file looks like this -

    drop table table_A
    *
    ERROR at line 1:
    ORA-00942: table or view does not exist

    7444 rows deleted.

    Commit complete.

    Thus, the SQL statement is not visible if it is error free. Is there a way to get around this?

    Thanks

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Did you try to SPOOL the results?
    This will do it:
    Code:
    SET ECHO ON
    SPOOL logfile.log
    @MyScript
    SPOOL OFF
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Sep 2004
    Posts
    9
    I added these commands in my script -

    set echo on
    spool log_file.log
    @script_name.sql
    spool off

    the log file only had this error message -

    SP2-0309: SQL*Plus command procedures may only be nested to a depth of 20.

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Quote Originally Posted by deltacorvi
    I added these commands in my script -

    set echo on
    spool log_file.log
    @script_name.sql
    spool off

    the log file only had this error message -

    SP2-0309: SQL*Plus command procedures may only be nested to a depth of 20.
    This error means what it means: your script executes a script that executes a script ...etc upto more that 20 levels deep.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •