Subject | Re: [firebird-support] Problem with where clause |
---|---|
Author | Svein Erling Tysvær |
Post date | 2018-01-05T12:25:23Z |
Normally, a query would contain something like:
WHERE CF.DATE_COMMANDE BETWEEN '1.1.2018' AND '2.1.2018'
What you are doing is forgetting the apostrophes and trying to use:
WHERE CF.DATE_COMMANDE BETWEEN 1.1.2018 AND 2.1.2018
which correctly receives a syntax error.
Either
V1=:V1 || ' WHERE CF.DATE_COMMANDE'||' BETWEEN '''||:FROM_DATE||''' AND '''||:TO_DATE||'''';
or (named parameters):
V1=:V1 || ' WHERE CF.DATE_COMMANDE BETWEEN :MY_FROM_DATE AND :MY_TO_DATE';
FOR EXECUTE STATEMENT (V1) (MY_FROM_DATE := FROM_DATE, MY_TO_DATE := TO_DATE)
INTO ...
or (positional parameters):
V1=:V1 || ' WHERE CF.DATE_COMMANDE BETWEEN ? AND ?';
FOR EXECUTE STATEMENT (V1) (FROM_DATE, TO_DATE)
INTO ...
HTH,
Set
2018-01-05 12:58 GMT+01:00 Köditz, Martin Martin.Koeditz@... [firebird-support] <firebird-support@yahoogroups.com>:
Hi,
I think there is a quote missing at the end of „:TO_DATE“;
Regards
Martin