Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2013

    Unanswered: KSH script to call a sql if there is an error


    Can some one help me please.
    I am new to korn shell scripting and need some help

    I have to code a ksh :

    I execute a db2 sql and if throws an error(Say DB21034E), I have to call a sql script.
    The shell script is already written for the following scenario, need help for the above mentioned scenario
    When an error occurs, I should create a dynamic permanent db2 table and then call a sql script.
    Please help!!

  2. #2
    Join Date
    Sep 2009
    Provided Answers: 1
    The ksh variable $? contains the result of the last executed command. It is zero if the command terminated normally, and non zero if it did not.
    You should test the value of the variable at the command line to confirm its values.
    If the value is always zero, that is, the processing of the error still results is a normal termination. then you should add sql code to output a status, and then examine the status instead of the $? variable.

Tags for this Thread

Posting Permissions

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