Fórum Erro na criaçãoTrigger #392341
13/12/2010
0
Galera, boa tarde
estou tentando criar a seguinte trigger
CREATE DEFINER = CURRENT_USER TRIGGER `tblfinanceiro_after_ins_tr1` AFTER INSERT ON `tblfinanceiro`
FOR EACH ROW
BEGIN
SELECT @V_ID:= MAX(IDHISTORICOFINANCEIRO)+1 from TBLHISTORICOFINANCEIRO where IdlocalHISTORICOFINANCEIRO=NEW.IDLOCALFINANCEIRO;
INSERT INTO tblhistoricofinanceiro(cidchavesfinanceiro,idempresa,cidchavescadastro,datalancamento,datafinanceiro,valor,identificacao,idhistoricofinanceiro,idlocalhistoricofinanceiro,cidchaves)
VALUES(NEW.CIDCHAVES,NEW.idempresa,NEW.cidchavescadastros,NEW.datalancamento,new.datalancamento,new.valor,new.identificacao,@V_ID,NEW.IDLOCALFINANCEIRO,CONCAT(@V_ID,'0',NEW.IDLOCALFINANCEIRO));
END;
esta dando erro na variavel, mas ja testei a select fora da trigger e funciona.
alguem pode me ajudar?
estou tentando criar a seguinte trigger
CREATE DEFINER = CURRENT_USER TRIGGER `tblfinanceiro_after_ins_tr1` AFTER INSERT ON `tblfinanceiro`
FOR EACH ROW
BEGIN
SELECT @V_ID:= MAX(IDHISTORICOFINANCEIRO)+1 from TBLHISTORICOFINANCEIRO where IdlocalHISTORICOFINANCEIRO=NEW.IDLOCALFINANCEIRO;
INSERT INTO tblhistoricofinanceiro(cidchavesfinanceiro,idempresa,cidchavescadastro,datalancamento,datafinanceiro,valor,identificacao,idhistoricofinanceiro,idlocalhistoricofinanceiro,cidchaves)
VALUES(NEW.CIDCHAVES,NEW.idempresa,NEW.cidchavescadastros,NEW.datalancamento,new.datalancamento,new.valor,new.identificacao,@V_ID,NEW.IDLOCALFINANCEIRO,CONCAT(@V_ID,'0',NEW.IDLOCALFINANCEIRO));
END;
esta dando erro na variavel, mas ja testei a select fora da trigger e funciona.
alguem pode me ajudar?
Agua Cascatai
Curtir tópico
+ 0
Responder
Posts
29/04/2013
José
Este tópico esta sendo fechado por inatividade. Se necessário, sinalizar para que seja reaberto ou abrir um novo.
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)