Issue Details (XML | Word | Printable)

Key: DNET-859
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Marcos R. Weimer
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

ExecuteScriptFromFile, Execute Block, UnknowStatement

Created: 20/Nov/18 12:38 PM   Updated: 23/Nov/18 08:58 AM
Component/s: ADO.NET Provider
Affects Version/s: 6.4.0.0
Fix Version/s: None

Environment: 5.9.1.0 a 6.4.0.0


 Description  « Hide
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;




 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura added a comment - 23/Nov/18 08:58 AM
You're missing SET TERM statement.