trap sqlerr in sql*plus exit - Page 3
DBAsupport.com Forums - Powered by vBulletin
Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: trap sqlerr in sql*plus exit

  1. #21
    Join Date
    Sep 2001
    Location
    Makati, Philippines
    Posts
    857
    Originally posted by pando
    I want to avoid create files that is where the problem arises

    I dont want to spool, I want to pass directly to $?

    I have a method which works for PL/SQL but not for pure SQL :(
    In this case awk won't help either since it requires file to do its task.

    geeh...
    You need a good shell script adv programmer that can manipulate
    the underlying source code that controls metacharacters such as this $?.

  2. #22
    Join Date
    Mar 2001
    Posts
    314
    How about this

    retval=`sqlplus -s uid/pwd@svc << EOF | grep ORA | cut -c 5-9
    select * from kk
    EOF`

    $ echo $retval
    00942

    -amar

  3. #23
    Join Date
    Jan 2001
    Posts
    2,828

    Talking

    Hello amar

    I have tried your solution .is it working for you.because its not working for me.

    hmm this one is sounding tougher then i originally thought ;-)

    regards
    Hrishy

  4. #24
    Join Date
    Mar 2001
    Posts
    314
    Hi Hrishy,

    Yes, my solution (proposed one at least!) is working for me

    There are no spaces between the "<<" and "EOF" - I put it there because otherwise the forum software will display only a "<" (or something similar but not '<< EOF').

    I am using "sh".


    -amar

  5. #25
    Join Date
    Mar 2000
    Location
    woodbridge,nj,USA
    Posts
    14

    exit code

    Hi Thanks for your reply,

    I have already investigated exit code, the problem with
    an exit code is that you can only pass a value to one variable
    and that variable has to be numeric

    Thanks
    Umesh

  6. #26
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    well as I mentioned it is possible with pl/sql but not with plain sql

  7. #27
    Join Date
    Mar 2001
    Posts
    314
    Hey Pando,

    I though I had a solution for you ??

    -amar

  8. #28
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    well not 100% solves

    I am using now pl/sql sooooo....

    would be perfect if whenever sqlerror exit sql.sqlcode works

Posting Permissions

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



Click Here to Expand Forum to Full Width