Professional Web Applications Themes

trigger transition tables - IBM DB2

hallo! i have the following questing: is it possible to reference the trigger transition tables (OLD_TABLE, NEW_TABLE) inside a procedure which is called from a statement trigger? e.g. i need a trigger create trigger trig_u_a after update on a referencing NEW_TABLE as new OLD_TABLE as old for each statement mode db2sql begin atomic values(proc_u_a(new, old)); end the stored procedure for example should look like create procedure proc_u_a(IN new tabletype, IN old tabletype) language sql .... insert into tab_c select new.col1, old.col1 ... from new, old .... is this possible? thanks andreas lederer...

  1. #1

    Default trigger transition tables

    hallo!

    i have the following questing:

    is it possible to reference the trigger transition tables (OLD_TABLE,
    NEW_TABLE) inside a procedure which is called from a statement trigger?

    e.g. i need a trigger
    create trigger trig_u_a after update on a
    referencing NEW_TABLE as new OLD_TABLE as old
    for each statement
    mode db2sql
    begin atomic
    values(proc_u_a(new, old));
    end

    the stored procedure for example should look like

    create procedure proc_u_a(IN new tabletype, IN old tabletype)
    language sql
    ....
    insert into tab_c select new.col1, old.col1 ... from new, old
    ....


    is this possible?

    thanks
    andreas lederer

    alederer Guest

  2. #2

    Default Re: trigger transition tables

    On DB2 z/Series you can pass the transition table via a table-locator.
    DB2 i/Series I don't know.
    DB2 for LUW you can't do it directly.
    Here is a trick:

    CREATE SEQUENCE uid;
    CREATE TABLE T1_NT AS (SELECT 1 AS id, T1.* FROM T1) DEFINITION ONLY;

    CREATE TRIGGER ... AFTER .. ON T1 REFERENCING NEW_TABLE AS nt ....
    BEGIN ATOMIC
    INSERT INTO T1_NT SELECT NEXT VALUE FOR uid, NT.* FROM Nt;
    VALUES (proc(PREVIOUS VALUE FOR uid));
    DELETE FROM T1_NT WHERE id = PREVIOUS VALUE FOR uid;
    END


    Serge Rielau Guest

Similar Threads

  1. navigation and transition in a pdf
    By James_Acott@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 0
    Last Post: November 1st, 05:50 PM
  2. Transition Logic
    By leotemp in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: June 27th, 06:22 PM
  3. [FLA MX] Transition effect
    By P.A. in forum Macromedia Flash
    Replies: 1
    Last Post: April 30th, 12:58 AM
  4. [Dir]Go to the frame + transition
    By Yeitor webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: September 11th, 02:25 PM
  5. Using Inserted and Deleted tables in Conjunction in a Trigger
    By Mark Simmerman in forum Microsoft SQL / MS SQL Server
    Replies: 3
    Last Post: July 9th, 07:41 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139