Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Mike Mandario

Problema com procedure firebird

Recommended Posts

Esta é a mensagem que retorne de erro no Ib console.

 

Dynamic SQL Error

SQL error code = -104

Token unknown - line 54, char 31

 

 

 

COMMIT WORK;

SET AUTODDL OFF;

SET TERM ^ ;

 

/* Stored procedures */

 

 

CREATE PROCEDURE "SP_IAD_CONTRATOS"

(

"OPERACAO" INTEGER,

"CTR_CODIGO" CHAR(6),

"CTR_DATACADASTRO" DATE,

"CTR_USRCADASTRO" VARCHAR(30),

"CTR_USRALTEROU" VARCHAR(30),

"CTR_DATAALTEROU" DATE,

"CTR_USRULTCONSULTA" VARCHAR(30),

"CTR_DATAULTCONSULTA" DATE,

"CTR_NOME" VARCHAR(80),

"CTR_CONV1" CHAR(1),

"CTR_ENDERECO" VARCHAR(120),

"CTR_BAIRRO" VARCHAR(40),

"CTR_CIDADE" VARCHAR(40),

"CTR_ESTADO" VARCHAR(2),

"CTR_CEP" VARCHAR(10),

"CTR_NASCIMENTO" DATE,

"CTR_TELEFONE" VARCHAR(20),

"CTR_CPF" VARCHAR(20),

"CTR_RG" VARCHAR(20),

"CTR_INICIO" DATE,

"CTR_TERMINO" DATE,

"CTR_EMAIL" VARCHAR(60),

"CTR_GRUPO" VARCHAR(6),

"CTR_PAI" VARCHAR(80),

"CTR_CONV2" CHAR(1),

"CTR_MAE" VARCHAR(80),

"CTR_CONV3" CHAR(1),

"CTR_SOGRO" VARCHAR(80),

"CTR_CONV4" CHAR(1),

"CTR_SOGRA" VARCHAR(80),

"CTR_CONV5" CHAR(1),

"CTR_ESPOSA" VARCHAR(80),

"CTR_CONV6" CHAR(1),

"CTR_BLOQUEADO" CHAR(1),

"CTR_MOTIVOBLOQ" VARCHAR(200),

"CTR_OBSERVACOES" BLOB

)

AS

BEGIN

 

if (operacao=1) then

insert into CONTRATOS ( CTR_CODIGO, CTR_DATACADASTRO, CTR_USRCADASTRO, CTR_USRALTEROU, CTR_DATAALTEROU, CTR_USRULTCONSULTA, CTR_DATACULTCONSULTA, CTR_NOME, CTR_CONV1, CTR_ENDERECO, CTR_BAIRRO, CTR_CIDADE, CTR_ESTADO, CTR_CEP, CTR_NASCIMENTO, CTR_TELEFONE, CTR_CPF, CTR_RG, CTR_INICIO, CTR_TERMINO, CTR_EMAL, CTR_GRUPO, CTR_PAI, CTR_CONV2, CTR_MAE, CTR_CONV3, CTR_SOGRO, CTR_CONV4, CTR_SOGRA, CTR_CONV5, CTR_ESPOSA, CTR_CONV6, CTR_BLOQUEADO, CTR_MOTIVOBLOQ, CTR_OBSERVACOES)

values (:CTR_CODIGO, :CTR_DATACADASTRO, :CTR_USRCADASTRO, :CTR_USRALTEROU, :CTR_DATAALTEROU, :CTR_USRULTCONSULTA, :CTR_DATACULTCONSULTA, :CTR_NOME, :CTR_CONV1, :CTR_ENDERECO, :CTR_BAIRRO, :CTR_CIDADE, :CTR_ESTADO, :CTR_CEP, :CTR_NASCIMENTO, :CTR_TELEFONE, :CTR_CPF, :CTR_RG, :CTR_INICIO, :CTR_TERMINO, :CTR_EMAL, :CTR_GRUPO, :CTR_PAI, :CTR_CONV2, :CTR_MAE, :CTR_CONV3, :CTR_SOGRO, :CTR_CONV4, :CTR_SOGRA, :CTR_CONV5, :CTR_ESPOSA, :CTR_CONV6, :CTR_BLOQUEADO, :CTR_MOTIVOBLOQ, :CTR_OBSERVACOES);

 

if (operacao=2) then

 

update CONTRATOS set CTR_CODIGO =:CTR_CODIGO,

CTR_DATACADASTRO =:CTR_DATACADASTRO,

CTR_USRCADASTRO =:CTR_USRCADASTRO,

CTR_USRALTEROU =:CTR_USRALTEROU,

CTR_DATAALTEROU =:CTR_DATAALTEROU,

CTR_USRULTCONSULTA =:CTR_USRULTCONSULTA,

CTR_DATACULTCONSULTA =:CTR_DATACULTCONSULTA,

CTR_NOME =:CTR_NOME,

CTR_CONV1, =:CTR_CONV1,

CTR_ENDERECO =:CTR_ENDERECO,

CTR_BAIRRO =:CTR_BAIRRO,

CTR_CIDADE =:CTR_CIDADE,

CTR_ESTADO =:CTR_ESTADO,

CTR_CEP =:CTR_CEP,

CTR_NASCIMENTO =:CTR_NASCIMENTO,

CTR_TELEFONE =:CTR_TELEFONE,

CTR_CPF =:CTR_CPF,

CTR_RG =:CTR_RG,

CTR_INICIO =:CTR_INICIO,

CTR_TERMINO =:CTR_TERMINO,

CTR_EMAL =:CTR_EMAL,

CTR_GRUPO =:CTR_GRUPO,

CTR_PAI =:CTR_PAI,

CTR_CONV2 =:CTR_CONV2,

CTR_MAE =:CTR_MAE,

CTR_CONV3 =:CTR_CONV3,

CTR_SOGRO =:CTR_SOGRO,

CTR_CONV4 =:CTR_CONV4,

CTR_SOGRA =:CTR_SOGRA,

CTR_CONV5 =:CTR_CONV5,

CTR_ESPOSA =:CTR_ESPOSA,

CTR_CONV6 =:CTR_CONV6,

CTR_BLOQUEADO =:CTR_BLOQUEADO,

CTR_MOTIVOBLOQ =:CTR_MOTIVOBLOQ,

CTR_OBSERVACOES =:CTR_OBSERVACOES

where CTR_CODIGO =:CTR_CODIGO;

 

if (operacao=3) then

delete from CONTRATOS

where CTR_CODIGO =:CTR_CODIGO;

end

^

 

SET TERM ; ^

COMMIT WORK;

SET AUTODDL ON;

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.