Unix Technical Forum

CREATE TRIGGER FOR INSERT, DELETE, UPDATE

This is a discussion on CREATE TRIGGER FOR INSERT, DELETE, UPDATE within the Informix forums, part of the Database Server Software category; --> Action is stored{kept} in what table made INSERT, DELETE, UPDATE Example for MS SQL : insert into table_name(col1,col2,col3,col4) select ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 05:31 PM
Picaso.Leonardo@gmail.com
 
Posts: n/a
Default CREATE TRIGGER FOR INSERT, DELETE, UPDATE

Action is stored{kept} in what table made INSERT, DELETE, UPDATE

Example for MS SQL :

insert into table_name(col1,col2,col3,col4) select col1, col2, 'I',
@RC from inserted

Best regards,
Leo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 05:32 PM
Jonathan Leffler
 
Posts: n/a
Default Re: CREATE TRIGGER FOR INSERT, DELETE, UPDATE

Picaso.Leonardo@gmail.com wrote:
> Action is stored{kept} in what table made INSERT, DELETE, UPDATE
>
> Example for MS SQL :
>
> insert into table_name(col1,col2,col3,col4) select col1, col2, 'I',
> @RC from inserted


The answer is in the Informix Guide to SQL: Syntax manual.
That is available from the IBM web site (quickest way there -
http://www.informix.com/) and look in the library.

I'm not sure how to interpret your question, though - one reason I've
not answered previously, hoping someone else would divine what you were
asking.

The basic mechanism is (for INSERT):

CREATE TRIGGER xx_insert INSERT ON xx
REFERENCING NEW AS NEW
FOR EACH ROW ( INSERT INTO raw_table VALUES('xx', new.col1,
new.col2, ..., USER, CURRENT YEAR TO FRACTION(5))

I've not checked the syntax - or EACH vs EVERY, for example, but the
basic idea might be enough to get you going.

You might also look up 'introspective triggers'. OTOH, you might not;
they're harder to write unless you're quite a good C programmer.

--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2007.0914 -- http://dbi.perl.org/

publictimestamp.org/ptb/PTB-2229 haval 2008-01-09 03:00:04
7F98FD0D66441624DB89B1A5EC250E1A
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:55 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com