?
Solved

why the diff in count with timestamp column?

Posted on 2011-05-12
7
Medium Priority
?
357 Views
Last Modified: 2012-05-11
comming back to the same question...
when i run this:
select count(*) from errors where error_tmstp >= to_timestamp ('01-Oct-10 00:00:00.000000', 'DD-Mon-RR HH24:MI:SS.FF');  --count = 1626417,
when i run this:
select count(*) from errors where error_tmstp < to_timestamp ('01-Oct-10 00:00:00.000000', 'DD-Mon-RR HH24:MI:SS.FF');  --count = 1080186.
the total count on the table is: 2706718, i am missing 115 rows, why is that?
I have to delete all rows prior to Oct 10th.
the field format is: ERROR_TMSTP  TIMESTAMP(6) WITH TIME ZONE,  -- 10/1/2010 12:07:11.000000 AM -04:00
the table is  active table, rows are getting written to it constatly but only about 10 rows in a couple of minutes.
0
Comment
Question by:Rao_S
  • 4
  • 3
7 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 35747388
NULL values  are neither >=  nor <  your timestamp literal

select count(*) from errors where error_tmstp IS NULL

should return your missing rows
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35747414
also note,  since your timstamps have timezone info in them,  you ought to include timezone in your select and delete criteria.


that's unrelated to your missing row problem, but you'll want to do it when you do the delete to be sure you're keeping the correct data
0
 

Author Comment

by:Rao_S
ID: 35747457
select count(*) from errors where error_tmstp IS NULL  ==> this one got me the missing rows!

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Rao_S
ID: 35747558
is this the right conversion for greenwich time?

select count(*) from errors where error_tmstp < to_timestamp_tz ('01-OCT-10 01.00.00.100000 PM -05:00',  'DD-MON-RR HH.MI.SSXFF PM TZR ') OR error_tmstp IS NULL;
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35747674
depends on where you are and if you are observing Daylight Saving Time or not.

Your EE profile says Pacific time  which is -7 including DST.

If your data is for the US, then Oct 1, 2010 is a DST time, but still don't know if Eastern/Central/Mountain/Pacific or other
0
 

Author Comment

by:Rao_S
ID: 35747714
i am Eastern time.
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35747799
Easter Daylight Time is  -4

October 1, 2010 is during daylight saving time for the US
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question