Insert Trigger Problem
Posted in 1997
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
I have several tables which must be tracked by a process management system. Whenever a new record is inserted into one of these key record tables, I want to insert a record into the process tracking table, which will assign a serial number automatically (SERIAL datatype). That is simple enough, but the catch is, I need the process serial number to be in the key record tables when all is said and done. This causes problems because SQL isn't going to let me reference the triggering table in any triggered statement or procedure. I tried using the BEFORE clause on the CREATE TRIGGER statement, inserting the process tracking record before the insert of the key record actually occurs, but then I can't figure out how to put the process serial value in the key record before the insert occurs. Is there some syntax that will allow me to reference fields in the record that is about to be written to the key record (triggering) table? I'd rather not have to split this process up and do it programmatically in PowerBuilder, I want the insert trigger to be able to complete the cycle, if at all possible. Changes to the table structure are possible, since this is in the early design stage. Thanks in advance... TJ -------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to Usenet