Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to query partitioned tables?
"Ron" <support_at_dbainfopower.com> wrote in message news:<e5idneLuipULPrDdRVn-uQ_at_comcast.com>...
> Hello RK,
>
> You are correct - small PL/SQL procedure cam be used to generate
> necessary SQL and "execute immediate" to execute it.
>
> Please, let us know if you'd need any additional help on it.
>
>
Thanks. I am not granted the right to write a procedure, I won't bother to try it out. However I do have another question here:
If I am querying on a date field as follows:
(1) select count(*) from table1 where dt_f1 = to_date('0210','MMDD');
(2) select count(*) from table1 where dt_f1 >= to_date('0210','MMDD') and dt_f1 < to_date('0211','MMDD');
(1) may not give me the correct count result, while (2) usually does. Why?
Next question, dt_f1 is the field used to partition table1, which is one day one partition, in the daily partition, only the same 'MMDD' value for dt_f1 may be allowed. If I am using the following:
(3) select count(*) from table1 partition(0210_name);
I got a somehow slightly bigger count number than if I am using (2) (result from (2) should be correct as I have the same data count from my data files). The daily partition is truncated and loaded every day, so it can not contain other date value for dt_f1. Can you explain possibly what happens here?
RK Received on Mon Feb 16 2004 - 12:29:07 CST
![]() |
![]() |