Problem with Insert Triggers
Posted in 1995
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Triggers, Constraints & Referential Integrity
I'm working on a client-server application which uses a DB Independent API to handle Oracle and Sybase and lately we are extending it to include Informix. This application also relies heavily on triggers and stored procedures to move most of the SQL logic on the server and thereby minimize network traffic. While porting the Oracle's/Sybase's stored procedures and triggers to Informix, I encountered some problems with the Informix insert triggers. Apparently, Informix insert triggers (unlike Sybase's and Oracle's) do not allow an update on any column of the triggering table (ie., an insert trigger cannot trigger an update of the same table). The insert statement in the application code is likewise generic or when hard coded (using ANSI SQL) applies to all RDBMS. Most of the values for the columns in the inserts are not supplied but are rather computed or determined based on some logic in the insert triggers. This limitation on insert trigger will force me to modify the application code (on the client side) where necessary to treat insert statements as a special case to handle this problem with the Informix insert trigger. Modifying the C/C++ source code is not a problem (as it is just a matter of adding conditional compilation or pre-processing and adding voluminous code to pre-compute the values in the inserts and by the way, we are using Informix CLI (Call Level Interface and not ESQL-C where you have to go thru several steps like binding columns before you can execute a single SQL). The problem is the load being moved to the client side may seriously add to the existing network traffic. I have ran out of ideas to work around the problem. I tried calling another procedure or trigger in the insert trigger to the do the update among others but none of them actually worked. If you have any suggestions, just post it in the newsgroups or e-mail me (jdeveza@infosoft.com, jdeveza@aol.com). Thanks!