Help with a trigger
I am trying to create a trigger that will look at the value of a particular field in a new record, compare it to a variable, and if it matches set another field.
I have tried something like this for a befor insert:
begin
declare chkcode char;
set @chkcode := 'whateverisetthisto';
if new.code = @chkcode
then new.passed = 1;
end if;
end;
That resulted in the record not being inserted. I changed it to an after insert with this code:
begin
declare chkcode char;
set @chkcode := 'whateverisetthisto';
if code = @chkcode
then update events set passed = 1;
end if;
end;
That would allow the record to insert, but it did not update the field as I wanted.
Can someone give me a hand figuring this out?
Thanks
Subject
Views
Written By
Posted
Help with a trigger
2324
August 10, 2015 01:16PM
1160
August 10, 2015 03:01PM
1171
August 10, 2015 03:39PM
1142
August 11, 2015 09:21AM
1162
August 11, 2015 09:35AM
1189
August 11, 2015 11:38AM
1153
August 11, 2015 11:43AM
1120
August 11, 2015 12:25PM
1152
August 15, 2015 09:20AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.