Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    18

    Unanswered: Exception / Error handlers in DB2?

    I have a bunch of SQL scripts (with shell script wrappers) to unload data like so

    Code:
    EXPORT TO /tmp/out.csv OF DEL MODIFIED BY NOCHARDEL  COLDEL, DATESISO 
        MESSAGES /tmp/out.msg SELECT WIDGETID
            ...
    I want to add an error handler to the script the way Oracle does it

    Code:
        WHENEVER SQLERROR EXIT FAILURE;
        SPOOL  /tmp/out.csv;
        SELECT WIDGETID...
        SPOOL OFF;
    According to DB2's documentation, this can be done in stored procedures, C, Perl, REXX....nothing else.

    Has anyone done this in SQL scripts? Can you provide pointers?

    Code:
    Running  DB2/LINUXX8664 9.7.2.`

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    have a look in the sample directory
    in sp you will have to use admin_cmd to execute this
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

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