How to return a status from sqlplus to .ksh unix script ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zvika Glickman

    How to return a status from sqlplus to .ksh unix script ?

    I have a script a.ksh as follow:

    [vashti]<oraspcat a.ksh
    sqlplus -s rsi/rsi < aaa1.sql
    echo stat $?
    [vashti]<orasp>

    text of aaa1.sql:

    exec dbms_stats.gath er_table_stats
    ('P0E1A00','MI_ AC_CIRBE_GEN',c ascade=>true,es timate_percent= >25);

    Problem: how can i transfer the status of the execution of
    dbms_stats.gath er_table_stats to the .ksh ????
  • Mark D Powell

    #2
    Re: How to return a status from sqlplus to .ksh unix script ?

    zglickman@il.bp hx.com (Zvika Glickman) wrote in message news:<b6b91e64. 0408112255.3e8e 7b82@posting.go ogle.com>...
    I have a script a.ksh as follow:
    >
    [vashti]<oraspcat a.ksh
    sqlplus -s rsi/rsi < aaa1.sql
    echo stat $?
    [vashti]<orasp>
    >
    text of aaa1.sql:
    >
    exec dbms_stats.gath er_table_stats
    ('P0E1A00','MI_ AC_CIRBE_GEN',c ascade=>true,es timate_percent= >25);
    >
    Problem: how can i transfer the status of the execution of
    dbms_stats.gath er_table_stats to the .ksh ????
    Z, look up the SQLPlus command "whenever sqlerror exit FAILURE"

    Many times all you need to pass back to the shell is success or
    failure. For the exact problem you can look at the spool file.

    In the case of a dmbs_stats I would generally not expect a failure
    message.

    HTH -- Mark D Powell --

    Comment

    • Zvika Glickman

      #3
      Re: How to return a status from sqlplus to .ksh unix script ?

      zglickman@il.bp hx.com (Zvika Glickman) wrote in message news:<b6b91e64. 0408112255.3e8e 7b82@posting.go ogle.com>...
      I have a script a.ksh as follow:
      >
      [vashti]<oraspcat a.ksh
      sqlplus -s rsi/rsi < aaa1.sql
      echo stat $?
      [vashti]<orasp>
      >
      text of aaa1.sql:
      >
      exec dbms_stats.gath er_table_stats
      ('P0E1A00','MI_ AC_CIRBE_GEN',c ascade=>true,es timate_percent= >25);
      >
      Problem: how can i transfer the status of the execution of
      dbms_stats.gath er_table_stats to the .ksh ????
      Thanks mark,
      I used:
      whenever sqlerror exit sql.sqlcode;

      Comment

      Working...