CODE :-
CREATE OR REPLACE TRIGGER user_address_check
BEFORE INSERT OR UPDATE ON street_master
FOR EACH ROW
BEGIN
DECLARE check INT;
check = STRCMP(street_master.locality_name,NEW.name);
if(check!=1)
then dbms_output.put_line('Record Already Exists');
End IF;
END;
street_master name of the table , locality_name of the column
-what i am trying to achieve
-compare each row of the column locality_name which has string(some address) stored in it with locality_name which i am about to insert ...so if there is a possible duplicate i should be notified
Should I use 'LIKE' instead of STRCMP ...if yes then how..?
Error i got after executing
1064 - Erreur de syntaxe près de 'TRIGGER user_address_check
BEFORE INSERT OR UPDATE ON street_master FOR EACH R' Ã la ligne 1
create or replace trigger ...command in MySQL. Drop the trigger then recreate it. See this question.create trigger.street_master. If this is what you're trying to do, just use a proper constraint.