Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Kolipaka
Starting Member
7 Posts |
Posted - 2008-10-20 : 05:54:22
|
| I have a table let suppose A with column C, D, E, F. Now I have to write a trigger on table A which should trigger when there is update on column C in Table A and then update the column D with the new value of C.I tried to do it as follows but the Column D is not being updated with the new value.************Create trigger trigg_name After update of C on A For each rowIsdeclarePragma Autonomous_transaction;New_val varchar2(27);BeginNew_val := :new.C;Dbms_output.put_line(New_val) ; /* this outputs the new value when evoking an update statement on Table A (Column C) */If updating thenUpdate A set D=:new.C where C=:old.C; /* After compiling the trigger and evoking an update statement on Table A (Column C) the D column still not being updated */ Commit;End;*************************Thanks in advance-Kolipaka |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-20 : 05:57:47
|
| Are you using MS SQL Server? |
 |
|
|
|
|
|