Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/01/2010, 10:50
yong321
 
Fecha de Ingreso: enero-2010
Mensajes: 29
Antigüedad: 14 años, 3 meses
Puntos: 3
Respuesta: Ayuda con Trigger

Cita:
Iniciado por bogeyboy Ver Mensaje
I have no error, when i say "no funciona" i mean that i try to verify if department_id is divisible by 10, if it's no disible it shouldn't insert any row into "departamento" but it doesn't verify anything and always insert the record when i do

"insert into departamento values (111,'Merchandising',123,456)" for example when i write this instruction should appear the message "Holita esto esta mal" and it doesn't.
I see what you mean. You can't do what you want. The trigger doesn't work like that. What your trigger code says is simply that before an insert, check if the department ID is divisable by 10. If not, output that line *and then continue to do the insert*. If yes, do an *extra* insert and then continue to do the regular insert, and of course in this case, the insert in the trigger code fires the trigger recursively, and then recursively, and ... until you hit ORA-36.

Anyway, the first if-block is an additional PL/SQL block, not something in place of the regular action of the trigger. That's the key you need to understand.

Yong Huang