Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509

    Unanswered: Reset errorlevel

    I have a problem. I have a script that creates a work file on the fly on an Oracle 7 database (NOT my code!). The table needs to be dropped if it already exists (Due to erroring during the previous run). What I need to do is drop the table, if it exists, before the create is done. The script that is running is a PL/SQL script and is not in a SQL block. Now the problem, The application that is running this script checks for errorlevel after sqlplus completes to detect if the script completed correctly. If I issue a bare "DROP TBALE XYZ" before the create, sqlplus will contine, but will have a non zero errorlevel when it exists. Is there some way to issue the drop table commands and then reset the internal errorlevel that sqlplus will report back to zero or is there a way to detect that the table exists without generating an error?
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can have good, fast, or cheap. Pick any TWO.
    A quick, dirty, but effective way is to invoke SQL*Plus twice from the script.
    The 1st only drops the table ALWAYS, and ignores any error.
    The 2nd does the needed work & checks status upon exit.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    I was afraid you would say that. The script interaction with the application can't be changed (canned package) and The script runs the application under an internal schema that only the canned package knows the password to. I guess that I can have the drop script login as a priviledged user and drop the tables using the host command. This would insure that no errorlevel is passed back to the calling script is passed. I was hoping to be able to do the drop command without generating any lasting errors.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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