Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to query partitioned tables?

Re: How to query partitioned tables?

From: Ron <support_at_dbainfopower.com>
Date: Fri, 13 Feb 2004 20:33:25 -0800
Message-ID: <e5idneLuipULPrDdRVn-uQ@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.

Regards,

  Ron
  DBA Infopower
  http://www.dbainfopower.com
  Standard disclaimer:
http://www.dbainfopower.com/dbaip_advice_disclaimer.html

"RK" <rekaben_at_yahoo.com> wrote in message news:239f1935.0402131916.58565f96_at_posting.google.com...
> "Ron" <support_at_dbainfopower.com> wrote in message
news:<2-adnTbC698BwrDdRVn-jA_at_comcast.com>...
> > Hello RK,
> >
> > You can do it this way:
> >
> > select a.cnt + b.cnt + c.cnt
> > from
> > ( select count(*) from tab1 partition(yesterday_name) p1 where p1.f2 =
> > yesterday ) a
> > ,( select count(*) from tab1 partition(today_name) p2 where p2.f2 =
today )
> > b
> > ,( select count(*) from tab1 partition(tomorrow_name) p3 where p3.f2 =>
> > tomorrow ) b
> >
> > As Sybrant mentioned, if you have only three partitions in a table you
can
> > run just one query to get count.
> >
> > Regards,
> >
> > Ron
> > DBA Infopower
> > http://www.dbainfopower.com
> > Standard disclaimer:
> > http://www.dbainfopower.com/dbaip_advice_disclaimer.html
> >
> >
> >
>
> Thanks.
>
> This may be the nice solution. However what if I have more partitions
> to add on? I have to make a generic script to do all that?
>
> RK
Received on Fri Feb 13 2004 - 22:33:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US