trigger execution against condition satisfaction
Posted
by maheshasoni
on Stack Overflow
See other posts from Stack Overflow
or by maheshasoni
Published on 2010-04-09T07:36:03Z
Indexed on
2010/04/09
7:43 UTC
Read the original article
Hit count: 148
Oracle
I have created this trigger which should give a error, whenever the value of new rctmemenrolno of table-receipts1 is matched with the memenrolno of table- memmast, but it is giving error in both condition(it is matched or not matched). kindly help me.
CREATE OR REPLACE TRIGGER HDD_CABLE.trg_rctenrolno
before insert ON HDD_CABLE.RECEIPTS1 for each row
declare
v_enrolno varchar2(9);
cursor c1 is select memenrolno from memmast;
begin
open c1;
fetch c1 into v_enrolno;
LOOP
If :new.rctmemenrolno<>v_enrolno
then
raise_application_error(-20186,'PLEASE ENTER CORRECT ENROLLMENT NO');
close c1;
end if;
END LOOP;
end;
© Stack Overflow or respective owner