Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecuteScriptFromFile, Execute Block, UnknowStatement [DNET859] #791

Closed
firebird-issue-importer opened this issue Nov 20, 2018 · 2 comments
Closed

Comments

@firebird-issue-importer

Submitted by: Marcos R. Weimer (marcosweimer)

on execute:

ExecuteScriptFromFile("filescript.sql", false);

Error:
The type of the SQL statement could not be determined. See also UnknownStatement event.
Statement: BEGIN IF ((SELECT COUNT(*) FROM CAIXA_MOVTO WHERE MOVTOCAIXA_ID_ORIGEM = 442 AND DATACAIXA IS NULL ) = 0) THEN DELETAR = TRUE.

"filescript.sql" is a file with several sqls (approximately 230 thousand)

SQL statement that displays the error:

EXECUTE BLOCK AS
DECLARE VARIABLE DELETAR BOOLEAN;
BEGIN
IF ((SELECT COUNT(*) FROM CAIXA_MOVTO WHERE MOVTOCAIXA_ID_ORIGEM = 42483 AND DATACAIXA IS NULL ) = 0) THEN
DELETAR = TRUE;
ELSE
DELETAR = FALSE;

IF (DELETAR) THEN
DELETE FROM CAIXA_MOVTO WHERE MOVTOCAIXA_ID_ORIGEM = 42483;
ELSE
UPDATE OR INSERT INTO CAIXA_MOVTO( MOVTOCAIXA_ID, OPERADOR_CAIXA, DATACAIXA, SEQCAIXA, DATA, OPERACAO_CAIXA, HISTORICO, VALOR, TIPO, TIPO_DC, IDNACERTO_PENDENTE, MOVTOCAIXA_CONTRAPARTIDA, MOVTOCAIXA_ESTORNADO, OPERADOR, TOTAL_PAGAMENTOS, TOTAL_RECEBIMENTO, TOTAL_RECEITAS, TOTAL_FATURAS_RECEBIDAS, TOTAL_FATURAS_PAGAS, TOTAL_DESPESAS, TOTAL_CHEQTERC_ENT, TOTAL_CHEQTERC_SAI, TOTAL_CHEQUES_EMITIDOS, TOTAL_DEBITOS_BANCARIOS, TOTAL_CREDITOS_BANCARIOS, TOTAL_RECEBIMENTOS, TOTAL_CARTAO, CODFILIAL, DESCONTO_CHEQUE_ID, LOTE_LIQUIDACAO, LOTE_NUMERARIO, TOTAL_DINHEIRO, TROCO, DESCONTO_DUPL_ID, PDV_NUMERO_CAIXA, PDV_ID_CAIXA_ABERTURA, PDV_NUM_CAIXA, TOTAL_CONTRAVALES_ENT, TOTAL_CONTRAVALES_SAI, MOVTOCAIXA_ID_ORIGEM ) VALUES( IIF((SELECT COUNT(*) FROM CAIXA_MOVTO CM WHERE CM.MOVTOCAIXA_ID_ORIGEM = 42483) > 0, (SELECT CM.MOVTOCAIXA_ID FROM CAIXA_MOVTO CM WHERE CM.MOVTOCAIXA_ID_ORIGEM = 42483), GEN_ID(GEN_CAIXA_MOVTO, 1)), 4, '08.11.2018', 401, '08.11.2018', 'TRANSFERÊNCIA', '', 55, 'N', 'D', 'N', 42484, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, NULL, NULL, 57, 0, 0, NULL, '4', 59, NULL, 0, 0, 42483) MATCHING (MOVTOCAIXA_ID);
END;

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 23, 2018

Commented by: @cincuranet

You're missing SET TERM statement.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 23, 2018

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants