Subject Re: [firebird-support] Problem with where clause
Author Mark Rotteveel
On 5-1-2018 12:52, m_brahim11@... [firebird-support] wrote:
> I am using FB 3 and IBExpert and with the DDL below I get message
> <Invalid token dynamic SQL error SQL error code= -104 unexpected end of
> command> and it works when I remove the where clause. I think the
> problem is with the between command. Can you please help me ?

Why are you using `execute statement`, and not simply `for select ...`?
There doesn't seem to be any reason why you need dynamically built SQL
here, as the only dynamic thing are the from_date and to_date
parameters, which would work just fine in `for select ...`.

So, first try to convert this to a normal `for select` statement.
Otherwise, if you really need dynamically generated SQL, change the last
line to:

V1=:V1 || ' WHERE CF.DATE_COMMANDE BETWEEN :FROM_DATE AND :TO_DATE';

and use `execute statement v1 (from_date := from_date, to_date :=
to_date) into ...`

Your immediate problems is caused by missing quotes around the date
values though.

Mark

--
Mark Rotteveel