Ver Mensaje Individual
  #3  
Antiguo 04-04-2007
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Reputación: 29
Lepe Va por buen camino
Gracias egostar, aunque eso también es un problema, porque no encuentro el significado.

NO ACTION significa que al borrar en la tabla principal, ¿no hace nada en la tabla con clave ajena?... o sea, se quedaría un Id huérfano, si es así no me interesa.

De momento lo estoy solucionando así, aunque no me gusta:
Código SQL [-]
CREATE TRIGGER CATEGORIA_BD FOR CATEGORIA
ACTIVE BEFORE DELETE POSITION 0
as
declare variable cuantos integer;
begin
    select first 1 idcategoria from Trabajador t
    where t.Idcategoria = old.Idcategoria
    into :cuantos;

    if (cuantos > 0) then
        exception NotdeleteCategoria;
end

Ya en delphi, en un ApplicationsEvents:
Código Delphi [-]
  if (e is EMDOError) then
  if (e is EMDOFirebirdError) then
  begin
    Notifica(maviso, dtm.ParseError(EMDOError(E)));
  end
ParseError, lo único que hace es quitar el texto "exception X" de la excepción.

Saludos.
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.
Responder Con Cita