We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,949 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Oracle Query

Hey Everyone,

I have table called vdet_sa_archive and in that table there are so many fields and i want to access the data on datetime range.

sample data in table

starttime endtime

1 14-02-13 01:30:15.000000000 AM 14-02-13 02:01:57.000000000 AM
2 14-02-13 4:30:01.000000000 AM 14-02-13 5:30:01.000000000 AM
3 14-02-13 01:30:01.000000000 PM 14-02-13 01:45:01.000000000 PM
So i want to access the data between 14-02-13 1:00:00 AM to 14-02-13 5:00:00 AM

So how can i get this data

i wrote like

select count(*) from vdet_sa_archive where starttime >= TO_DATE('14/FEB/2013 01:00:00 AM', 'dd/mm/yyyy HH:MI:SS AM') and endtime<=TO_DATE('14/FEB/2013 04:00:00 AM', 'dd/mm/yyyy HH:MI:SS AM');

But its not working.

Thanks and regards,
snehal

3
Contributors
2
Replies
2 Weeks
Discussion Span
2 Months Ago
Last Updated
30
Views
snehal89
Newbie Poster
1 post since Feb 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

what is your datatype of startime, endtime, i guess it of type date and not varchar

if its date type, then you need not to use to_date

simply starttime>'14-feb-2012 01:00:00 am' will work

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

SELECT COUNT(*)
FROM VDET_SA_ARCHIVE
WHERE STARTTIME >= TO_CHAR('14/FEB/2013 01:00:00 AM', 'dd/mm/yyyy HH:MI:SS AM')
and endtime<= to_char('14/FEB/2013 04:00:00 AM', 'dd/mm/yyyy HH:MI:SS AM');

ghulamyassen
Newbie Poster
1 post since Mar 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.5357 seconds using 2.68MB