Estoy de acuerdo con usted, pero, corrigeme si estoy mal, si en un dbGrid lo enlazo a un ibDataset por medio de un DataSource, al abrir un Nuevo Registro en el dbGRid, manda a llamar la Instrucción Post+Insert, obviamente porque Graba el Registro Anterior e Inserta el Siguiente, entonces si manda la Instrucción "Post", porque no llama el Trigger si en la propiedad ModifiSQL del IbDataset tengo la sentencia SQL:
Código SQL
[-]
size="1">update TFAC_DPROMOCIONES
size="1">set
size="1">ARTICULO = :ARTICULO,
size="1">CLIENTE = :CLIENTE,
size="1">DESCTO = ESCTO,
size="1">INDICE = :INDICE,
size="1">PRECIO = :PRECIO,
size="1">SUCURSAL = :SUCURSAL
size="1">where
size="1">CLIENTE = :OLD_CLIENTE and
size="1">INDICE = :OLD_INDICE and
size="1">SUCURSAL = :OLD_SUCURSAL
y en la Propiedad InsertSQL tengo
Código SQL
[-]
size="1">insert into TFAC_DPROMOCIONES
size="1">(ARTICULO, CLIENTE, DESCTO, INDICE, PRECIO, SUCURSAL)
size="1">values
size="1">(:ARTICULO, :CLIENTE, ESCTO, :INDICE, :PRECIO, :SUCURSAL)
Y el Trigger lo tengo Antes ó después de "Insertar" y "Modificar" y no me regresa nada.
En el Trigger tengo esto:
Código SQL
[-]
execute procedure dame_indice_dpromociones(new.sucursal, new.cliente) returning_values new.indice;
if (new.indice=0) then
new.indice=1;
Y en el Procedimiento Almacenado tengo esto:
Código SQL
[-]
Select Max(indice)+1 from tfac_dpromociones
where Sucursal=:Sucursal and
Cliente=:Cliente
into:xindice;
Gracias por sus comentarios. Espero haberme explicado.