Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    155

    Unanswered: Is this a wise running line?

    Hallo everyone,

    I am running my sql script over command line like this:

    Code:
    db2 -mtf ${EXPORTSQL5} &> ${EXPORTSQL5}.log || die "Error in 5th Script"
    From the db2 documentation, it says:
    0
    DB2 command or SQL statement executed successfully
    1
    SELECT or FETCH statement returned no rows
    2
    DB2 command or SQL statement warning
    4
    DB2 command or SQL statement error
    8
    Command line processor system error
    Does it mean, in case of SQL-Statement error, db2 returns number 4. Is this number automatically the return code of the shell line? I think this is rather a shell script question than db2, but maybe the people would help me too. Thank you..

    &> means that stdout and stderr both will be written in a file. I wonder, if db2 write an error, how can shell actually recognize that this error is a stderr? Or, if db2 writes a warning, will this warning be transferred to a stdout or stderr?

    Regards,

    Ratna

  2. #2
    Join Date
    Mar 2003
    Posts
    280
    4 is the exit status. You can get the value from $? immediately after executing the query

Posting Permissions

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