Invalid host/bind variable name ORA-01745

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Valgardur
Posts: 164
Joined: Tue 24 Nov 2009 19:33

Invalid host/bind variable name ORA-01745

Post by Valgardur » Thu 16 Feb 2017 17:33

While updating a old application I get "invalid host/bind variable name" for a query

Code: Select all

select Pot, count(*) value
from Pots
WHERE Pot BETWEEN :PotFrom AND :PotTo 
  and Dt >= ( :Date -10 )
  and Dt < (:Date + 1)
Group by Pot
When trying to work with TOraQuery.

If I change ":Date" to something else, ":Dat" everything is fine.

The problem is probably the fact the "Date" is a reserved word, but in this case, only as a parameter.

And yes (long explanation, but) simply changing to ":Dat" will take (almost) forever.

MaximG
Devart Team
Posts: 1375
Joined: Mon 06 Jul 2015 11:34

Re: Invalid host/bind variable name ORA-01745

Post by MaximG » Wed 01 Mar 2017 11:30

You cannot use an auxiliary word DATE as a query parameter name, it is Oracle server restriction that is demonstrated by the error ORA-01745

Valgardur
Posts: 164
Joined: Tue 24 Nov 2009 19:33

Re: Invalid host/bind variable name ORA-01745

Post by Valgardur » Wed 01 Mar 2017 12:44

Thanks, but this actually does work in old code (using BDE)

Post Reply