Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Open table with primary key
In article <t0Sl2.1457$kt3.23787_at_typhoon-sf.pbi.net>,
remove.duchuynh_at_pacbell.net (D Huynh) wrote:
> When opening up an Oracle table with a primary key (using ADO, in
> particular) does Oracle automatically use the associated primary key or
> do
> we have to do so explicitly?
>
> TIA.
>
>
>
One way which should do this is to add a single WHERE clause specifying each column in the primary key to be greater than some value which is smaller than the smallest possible value in the index. You should reference all values used in the primary key in the same order as declared. We have used this successfully in one of our projects.
I've seen now that an 'order by' clause (in Oracle 7.3.4) with properly analysed indexes will use the correct index although I don't think this has always been the case.
Dave Lane (dlane_at_pt.lu) Received on Fri Jan 15 1999 - 15:02:10 CST
![]() |
![]() |