Results 1 to 4 of 4
  1. #1
    Join Date
    May 2013

    Unanswered: complex trigger scenario


    I was wondering if this was possible with DB2 syntax. I think a trigger might do it, but this might be a little too complex.

    Before Insert:

    1) Check Size of Insert
    2) Check Number of Rows
    3) If size of insert exceeds some pre-determined value, delete rows ORDER BY something until size fits.
    4) If insert exceeds some row count size, delete first row of ORDER BY something
    5) Do Insert.

  2. #2
    Join Date
    Apr 2006
    Provided Answers: 11
    probably not
    why not using a stored proc

    or a script if o/s commands are needed..
    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

  3. #3
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    Not the way you describe. You can only determine the "size of insert" (I take it you mean the number of inserted rows) in an AFTER trigger, at which point the rows are already inserted, so your options are limited to rolling back the entire statement or leaving the rows be.
    "It does not work" is not a valid problem statement.

  4. #4
    Join Date
    May 2013
    thanks for the replies.

    would it be possible to have the trigger call a stored procedure?

Posting Permissions

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