Hi,


I have just started to learn databeses recently and I have had no problem until I have started to do PL/SQL and Triggers as my programming knowledge is null.
I need to do a simple trigger where two columns on a table can't have the same value so here is hwat I have tried on Oracle 10g but don't seem to work. Anyone knows what's the problem?? Thanks.

CREATE OR REPLACE TRIGGER clave_unica

BEFORE INSERT OR UPDATE OF usuario,clave

ON agentes FOR EACH ROW

WHEN clave=UNIQUE

Begin

IF new:clave IS NOT UNIQUE THEN

RAISE_APPLICATION_ERROR (-1422,'Un agente no puede coincidir en clave y usuario')

ELSIF new:usuario IS NOT UNIQUE THEN

RAISE_APPLICATION_ERROR (-1422,'Un agente no puede coincidir en clave y usuario')

END IF;

END clave_unica

/