Subject Re: [firebird-support] Firebird : Arithmetic overflow exception only in execute block statement
Author Mark Rotteveel
On 2018-05-05 19:49, Issam Boughanmi amigoface@...
[firebird-support] wrote:
> i have this heterogeneous cross database query
>
> execute block as
> DECLARE panum INT;
> DECLARE nom varchar(50);
> DECLARE prenom varchar(50);
> DECLARE dna date;
> DECLARE datemodif date;
> DECLARE m date;
> DECLARE VARIABLE VSQL VARCHAR(100);
> begin
> VSQL = 'select panum, nom, prenom, dna, DATEMODIF from patient where
>
> (datemodif is not null ) and (datediff (day from current_date to
> cast(DATEMODIF as date))>-2)';
>
> FOR execute statement VSQL ON EXTERNAL DATA SOURCE
> 'localhost/3050:C:/BDD/Replications/Source/D2018.gdb' AS USER
> 'sysdba'
> PASSWORD 'masterkey'
> INTO :panum, :nom, :prenom, :dna, :DATEMODIF DO
>
> suspend;
> end;
>
> wich give me an arithmetic overflow or string truncation error .
>
>
> if
> i run the query in a single database it work fineselect panum, nom,
> prenom, dna, DATEMODIF from patient where (datemodif is
> not null ) and (datediff (day from current_date to cast(DATEMODIF as
> date))>-2)
>
> if i remove the datediff where clause condition in the original query
> it work also.
>
> the two databases are exactly the same (schema and data), actually
> it's a copy/paste .
>
> any idea on what's going on please ?

The query you are trying to assign to VSQL is longer than 100 characters
(162 according to my editor, including new lines). You'll need to
declare VSQL to be larger than VARCHAR(100).

Mark