Jailton,
Segue a Trg:
CREATE OR ALTER TRIGGER GRAVA_CN_TB_ALUNOS FOR TB_ALUNOS
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
AS
declare variable NOME_IP varchar(30);
declare variable PROCESSO_REMOTO varchar(50);
declare variable DIAHORA timestamp;
declare variable DIA smallint;
declare variable MES smallint;
declare variable ANO smallint;
declare variable HORA smallint;
declare variable MINUTO smallint;
declare variable SEGUNDO smallint;
declare variable USUARIOS smallint;
begin
select count(MON$ATTACHMENT_ID) as USUARIOS from mon$attachments INTO :usuarios;
select MON$REMOTE_ADDRESS, MON$REMOTE_PROCESS from mon$attachments where mon$attachment_id = current_connection INTO :NOME_IP,:PROCESSO_REMOTO;
Select Extract(Day From current_date) as dia,
Extract(Month From current_date)as mes,
Extract(Year From current_date) as ano,
Extract(hour From current_time) as hora,
Extract(MINUTE From current_time)as minuto,
Extract(SECOND From current_time) as segundo
from rdb$database
into :dia, :mes, :ano, :hora, :minuto, :segundo;
if (inserting) then
begin
new.cn = (:ANO||LPAD(:MES,2,0)||LPAD(:DIA,2,0)||:hora||LPAD(:minuto,2,0)||LPAD(:segundo,2,0)||:NOME_IP||LPAD(:usuarios,2,0)||:PROCESSO_REMOTO); end
if (updating) then
begin
new.cn = (:ANO||LPAD(:MES,2,0)||LPAD(:DIA,2,0)||:hora||LPAD(:minuto,2,0)||LPAD(:segundo,2,0)||:NOME_IP||LPAD(:usuarios,2,0)||:PROCESSO_REMOTO);
end
end
O que acabei de reparar, é que no desenvolvimento (meu computador), ela está atualizando o campo CN perfeitamente pelo SC. Agora quando passo para a produção (Kinghost), ela está gravando CN como null… Mas o formulário está atualizando outras tabelas perfeitamente.
Abs