Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Triggers in SQL Server - triggers in Oracle
>
> b) how can I modify the values of variables inside a trigger?
>
> the equivalent in Oracle would be:
>
> IF :NEW.STATUS='A0' THEN
> :NEW.STATUS:='AC';
>
As far as I remember there are logical tables INSERTED and DELETED in MS SQL, the first contains rows that are inserted and updated, the second contains rows that are deleted and updated. By joining the INSERTED and DELETED tables with the related table u can get the new/old values of the rows. Note that u cannot modify INSERTED and DELETED tables.
This sample seems to work, of course u should check the docs for more complex tasks
CREATE TRIGGER test_trigger
ON marin_test
FOR INSERT AS
BEGIN
UPDATE marin_test SET marin_test.test_char = 'AC' FROM inserted WHERE marin_test.test_id = inserted.test_id AND inserted.test_char = 'A0'END hth,
Marin
"The happier people can be, the unhappier they are..."
"Veronika decides to die", Paolo CoelhoReceived on Fri Oct 06 2000 - 14:02:40 CDT
![]() |
![]() |