Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    9

    Question Unanswered: SQL running completion status in a shell script

    I have a UNIX shell scripts as follow. It is to execute an PL/SQL program by running a SQL script (insert_new_record.sql).

    -----------------------------------------------------------------------------------
    #!/bin/sh
    now=`date '+%m/%d/%y %H:%M:%S'`

    echo "(B) PL/SQL Processing (insert_new_record.sql)"
    sqlplus / <<-eof
    @insert_new_record.sql
    quit
    eof

    echo "Code returned is $?"
    echo "(E) PL/SQL Processing (insert_new_record.sql)"
    now=`date '+%m/%d/%y %H:%M:%S'`
    -----------------------------------------------------------------------------------

    The difficulties is how can I know the completion status (successful or failure) of the SQL script insert_new_record.sql. I have tried the UNIX environment variable $? but it seemes that it always returns a value of zero no matter the execution of the SQL script is successful or not.

    Thanks for any expert's advice!

  2. #2
    Join Date
    Aug 2003
    Posts
    5
    Using $? will not work if the command is not running in the shell.
    A better idea could be to spool the sql session to a file. Then do a grep on the file to find if has an "ORA" exception.

    Hope this helps


    Thanks

Posting Permissions

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