Hi, I have the following code in Informix 4GL, but I am running problem and unable to findout, please help me. Thank you.
CREATE PROCEDURE trig_insert_test1(ncode CHAR(2), nname CHAR(32))
DEFINE ocode CHAR(2);
FOREACH SELECT code INTO ocode
FROM state
WHERE code = ncode OR sname = nname
RAISE EXCEPTION -271, 100, "Value already exists";
END FOREACH;
END PROCEDURE
create trigger inst_test1 insert on state
referencing new as new
for each row (execute procedure trig_insert_test1(new.code,new.sname));
CREATE PROCEDURE trig_insert_test1(ncode CHAR(2), nname CHAR(32))
DEFINE ocode CHAR(2);
FOREACH SELECT code INTO ocode
FROM state
WHERE code = ncode OR sname = nname
RAISE EXCEPTION -271, 100, "Value already exists";
END FOREACH;
END PROCEDURE
create trigger inst_test1 insert on state
referencing new as new
for each row (execute procedure trig_insert_test1(new.code,new.sname));