Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    1

    Unanswered: returning errors from SQLPlus to DOS batch script

    hi, I have a dos batch file that starts sqlplus and runs an sql file. My batch file needs to find out if any exceptions occured during sqlplus execution but I am unsure how to do this. Messing around I tried modifying a system envionment variable using the host command like this:
    begin

    [sql stuff]

    exception
    when others then
    host set systemError = 1;

    end;

    unfortunately host doesn't appear to be that versatile and I get an error.
    Any ideas on how I could get sqlplus to return this kind of information back to a batch file?

    thanks,
    Patrick

  2. #2
    Join Date
    Oct 2003
    Location
    St.Louis,MO
    Posts
    120

    Re: returning errors from SQLPlus to DOS batch script

    Originally posted by elchuppa
    hi, I have a dos batch file that starts sqlplus and runs an sql file. My batch file needs to find out if any exceptions occured during sqlplus execution but I am unsure how to do this. Messing around I tried modifying a system envionment variable using the host command like this:
    begin

    [sql stuff]

    exception
    when others then
    host set systemError = 1;

    end;

    unfortunately host doesn't appear to be that versatile and I get an error.
    Any ideas on how I could get sqlplus to return this kind of information back to a batch file?

    thanks,
    Patrick
    have you tried adding
    spool (absolute file name) as the first line of the .sql file
    and
    spool off as the last line of the .sql file
    ??

    ex.
    spool c:\database\spoolfile.txt
    .............
    ..................
    ..................
    spool off
    Last edited by tlael; 11-10-03 at 18:05.

Posting Permissions

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