I'm learning Oracle and I had a problem. I have my Chat table:
create table Charla (
id_charla number,
codigo_usuario number,
fecha_charla date,
fecha_fincharla date
)
Now, create a trigger so that it does not allow me to enter a "Chat" if a previous one was already registered with the same user_code. This is my trigger:
create or replace trigger DISCHARLA
before insert on CHARLA
for each row
begin
if :new.codigo_usuario = :old.codigo_usuario then
Raise_Application_Error(-20099,'NO PUEDE REGISTRAR OTRA CHARLA SI AUN MANTIENE CHARLA VIGENTE.');
end if;
end DISCHARLA;
But still it still allows me to enter Talks with the same user code. Any help or recommendation to improve my trigger that does not work.
Thank you.