Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Finding TIMESTAMP rows

BeefStuNov 30 2022

I'm experimenting with finding a range of TIMESTAMPs. As you can see below I can successfully retrieve rows when I use the 'between" method.

When I try to use >= and < operators I'm getting a syntax error. My question is it possible to use the second method to find TIMESTAMP rows? If so, how can I get the second query to work?
Thanks in advance to all who respond and your expertise.

CREATE TABLE TABLE_NAME(
   ts TIMESTAMP 
);

INSERT INTO TABLE_NAME (ts) VALUES (TO_TIMESTAMP('2022-11-30 06:14:00.742000', 'YYYY-MM-DD HH24:MI:SS.FF'));

INSERT INTO TABLE_NAME (ts) VALUES (TO_TIMESTAMP('2022-11-30 06:14:00.742001', 'YYYY-MM-DD HH24:MI:SS.FF'));

INSERT INTO TABLE_NAME (ts) VALUES (TO_TIMESTAMP('2022-11-30 06:14:00.742002', 'YYYY-MM-DD HH24:MI:SS.FF'));

INSERT INTO TABLE_NAME (ts) VALUES (TO_TIMESTAMP('2022-11-30 06:14:00.742003', 'YYYY-MM-DD HH24:MI:SS.FF'));

INSERT INTO TABLE_NAME (ts) VALUES (TO_TIMESTAMP('2022-11-30 06:14:00.742004', 'YYYY-MM-DD HH24:MI:SS.FF'));

SELECT *
  FROM TABLE_NAME 
 WHERE ts 
   BETWEEN TO_TIMESTAMP ('2022-11-30 06:14:00.742001', 'yyyy-MM-dd HH24:mi:ss.ff6')
       AND TO_TIMESTAMP ('2022-11-30 06:14:00.742003', 'yyyy-MM-dd HH24:mi:ss.ff6');

TS
30-NOV-22 06.14.00.742001 AM
30-NOV-22 06.14.00.742002 AM
30-NOV-22 06.14.00.742003 AM

Fingselect * from table_nane
 where ts >= 
'2022-11-30 06:14:00.742001', 'yyyy-MM-dd HH24:mi:ss.ff6' AND
ts < '2022-11-30 06:14:00.742004', 'yyyy-MM-dd HH24:mi:ss.ff6';
This post has been answered by Saubhik on Nov 30 2022
Jump to Answer

Comments

843798
Hi,
I think you are using trial version of Java Web Server. If this is the case then either purchase the web server or if you wish to continue the evaluation period which is 30 days right now then Completely unstall the webserver and then install it again. I hope this will solve your problem..
Bye,
Rajeev
843798
Hi!

I managed to solve the problem, it was regarding setting the PATH. There's a bug in JWS2.0, and the FAQ's helped me out. Thanks for your answer!

1 - 2

Post Details

Added on Nov 30 2022
6 comments
274 views