I have a table which contains a column of type TIMESTAMP(6), if I try to query this table everything is fine as long as I don't parametrize it.
This works:
SELECT
COUNT(*)
FROM
t_data
WHERE
DATA_TS >= TO_TIMESTAMP('13.09.18 11:30:00')
AND DATA_TS <= TO_TIMESTAMP('13.09.18 11:33:00');
However this fails with ORA-01858 "a non-numeric character was found where a numeric was expected" supplying the values as stated above. I also tried to wrap the parameters in TO_TIMESTAMP() using the format Mask from the NLS_PARAMETERS.
SELECT
COUNT(*)
FROM
t_data
WHERE
DATA_TS >= TO_TIMESTAMP(:AStart,'DD.MM.RR HH24:MI:SSXFF')
AND DATA_TS <= TO_TIMESTAMP(:AEnd,'DD.MM.RR HH24:MI:SSXFF');
Anyone knows what causes this issue?
Testcase: Create Table
create table t_data (
data varchar2(80),
data_ts timestamp
);
Insert DATA
Insert into t_data (data,data_ts) VALUES ('TEST', systimestamp);
Using &AStart instead of :AStart works well, if that helps somebody
You should use param inside the function