Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Simple SQL quetsion
A true primary key can't be null. If this is truly a primary key, select count(*) should be the same as selecting count(distinct primary_key).
Here is one way to check for distinct composite key...
select count(distinct to_char(organization_id) + to_char(inventory_item_id)) k
from inv.mtl_system_items;
Bill Bearden
Consultant
Nimrod Oren <orenn_at_inter.net.il> wrote in article
<339F1A31.3242EF0_at_inter.net.il>...
> I'm using the rule-based optimizer and I try to get the number of
> records from a table with a composite primary-key.
> Select count(*) does a full table scan. Is there a way to count the
> occurrences of the primary key (hopefully without hints)?
>
>
Received on Thu Jun 12 1997 - 00:00:00 CDT