Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> OCI query problem
Hi,
I have a database table which has a column of type date. I have a
application which fires queries on the database. The query fired is
like
SELECT COUNT(*), LOWER(EmployeeID) FROM BAT_Users150 WHERE (
(LOWER(EmployeeID) = LOWER('63')) ) AND ( LOWER(Birthdate') =
LOWER('14-03-1975') ) GROUP BY LOWER(EmployeeID) ORDER BY
LOWER(EmployeeID);
or
SELECT COUNT(*), EmployeeID FROM BAT_Users150 WHERE ( (EmployeeID =
63) ) AND ( Birthdate = {ts '1975-03-14 00:00:00'} ) GROUP BY
EmployeeID ORDER BY EmployeeID;
(This query doesn't work from the tool SQL*plus but work from winsql)
Even the query
SELECT COUNT(*), EmployeeID FROM BAT_Users150 WHERE ( (EmployeeID =
63) ) AND ( Birthdate = '1975-03-14 00:00:00') GROUP BY EmployeeID
ORDER BY EmployeeID;
does not work
Here birthdate is of type date at the backend(oracle)
The same query works if the query is modified to
SELECT COUNT(*), LOWER(EmployeeID) FROM BAT_Users150 WHERE (
(LOWER(EmployeeID) = LOWER('63')) ) AND ( to_char(Birthdate,
'dd-mm-yyyy') = LOWER('14-03-1975') ) GROUP BY LOWER(EmployeeID) ORDER
BY LOWER(EmployeeID);
But its difficult for me to modify my query this way.
Can anyone tell my why the above queries are not working and if there
is any workaround ?
The error displayed is ORA-00911: invalid character
Thanks in advance Received on Tue Mar 14 2006 - 02:26:21 CST