Re: trigger on insert: updating one value of the same table
Posted in 2009
Have an external program that opens a cursor on the staging table, processes whatever it finds then loops and starts again. If the cursor finds no work to do, sleep for a reasonable time and try again. That way the worst case delay is during quiet periods and is the sleep time, normally everything gets processed very quickly. Art Art S. Kagel Oninit (www.oninit.com) IIUG Board of Directors (art@iiug.org) See you at the 2010 IIUG Informix Conference April 25-28, 2010 Overland Park (Kansas City), KS www.iiug.org/conf Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Oninit, the IIUG, nor any other organization with which I am associated either explicitly or implicitly. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Fri, Dec 11, 2009 at 11:09 AM, Gentian Hila <genti.tech@gmail.com> wrote: > On Thu, Dec 10, 2009 at 5:46 PM, Art Kagel <art.kagel@gmail.com> wrote: > > Insert a row from the INSERT TRIGGER into another staging table > containing > > the keys to the inserted row. Then a separate task can run or loop every > N > > seconds that extracts new rows from the staging table, performs the > update, > > and deletes the staging row. > > > > Art > > > > Art S. Kagel > > Oninit (www.oninit.com) > > IIUG Board of Directors (art@iiug.org) > > > > See you at the 2010 IIUG Informix Conference > > April 25-28, 2010 > > Overland Park (Kansas City), KS > > www.iiug.org/conf > > > > Disclaimer: Please keep in mind that my own opinions are my own opinions > and > > do not reflect on my employer, Oninit, the IIUG, nor any other > organization > > with which I am associated either explicitly or implicitly. Neither do > > those opinions reflect those of other individuals affiliated with any > entity > > with which I am affiliated nor those of the entities themselves. > > > > > > > > On Thu, Dec 10, 2009 at 3:38 PM, Gentian Hila <genti.tech@gmail.com> > wrote: > >> > >> I have a program that is closed to us. It inserts a new row, every > >> column of the table. > >> > >> I want one to update the value of one column on the inserted row. > >> > >> I tried a INSERT on trigger but since the column is included on the > >> insert it gives me the error: > >> > >> "table or column matches object referenced in triggering statement". > >> > >> Is there a way that I can achieve this through a trigger? > >> > >> That would be extremely helpful. > >> > >> Thank you, > >> _______________________________________________ > >> Informix-list mailing list > >> Informix-list@iiug.org > >> http://www.iiug.org/mailman/listinfo/informix-list > > > > > > > > Thank you, > > This should work. The only thing I am worried is that there are many > insertions and the value should change not to long after the insertion > so I guess I will have to run the procedure every 2 seconds. It will > be extra lookup when there are no insertions at all. > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list >