Hi, i�am a trainee and new to SAP DB.
It�s my job trying to migrate our DB2 Database to SAP DB. My main 
problem ist to create trigger for insert and update actions.

If a row updated in the table the trigger should set the current date 
for this row.
e.g.

create table actions (      
       status     char(3),           
       aktdat     date,              
       verw_id    integer,           
       objec_id   integer,           
       obj_name   char(20),          
       typ        char(1),
       constraint pk_actions primary key (actio_id)).

Now someone update values for objec_id or anything else and the 
trigger has to set aktdat = current date. !Only in the updated row!

The originial DB2 Trigger was:

create trigger db2admin.n_actions_date no cascade before insert on 
db2admin.actions 
referencing new as new 
for each row mode db2sql
set new.aktdat = current date

create trigger db2admin.u_actions_date no cascade before update on 
db2admin.actions
referencing old as old new as new 
for each row mode db2sql 
set new.aktdat = current date

For the insert trigger i�ve tried:
create trigger n_actions_date for test.actions after insert execute (
  update test.actions
  set aktdat = date(now()) where actio_id = :new.actio_id ;)

It works, but how to create the update trigger. All i tried causes an 
update in all rows and not only in the changed row.

Best Regards

Ulrich Kneisel


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to