Hi,
I want a simple sql (trigger) for duplicate checking. My table name is test1 with 2 columns code and sname, before inserting new record, check - if the record is already exist, then error, not insert. or Insert it.
Thank you, Magni
I need help with this following. I created the following procedure and trigger but getting error. This I am using for inofrmix 4GL. Thankyou.
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));
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.