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: Primary keys don't work?

Re: Primary keys don't work?

From: Andrew Hardy <nobody_at_spam.from.news.AdvanticaTech.com>
Date: Wed, 19 Sep 2001 21:13:46 +0100
Message-ID: <9oauai$6rh$1@sun-cc204.lut.ac.uk>


A primary key does not imply the order in which rows are returned in SQL.

To determine the order in which you want to return your data, use the ORDER BY clause.

Andy

"Jan Doggen" <massoft_at_tref.nl> wrote in message news:9oaq2j$4a0$1_at_reader05.wxs.nl...
> Hi everyone,
>
> in Delphi 4 we're creating and accessing tables through the BDE and TCP/IP
> connections to an Oracle 8 database.
> These tables have single-field primary keys, either created with
>
> > CREATE TABLE
> > ...
> > CONSTRAINT PK_INDX PRIMARY KEY (fldname)
> or
> > CREATE TABLE
> > followed by
> > ALTER TABLE ADD PRIMARY KEY(fldname)
>
> Sometimes the records are *not* ordered by their primary key:
> - if we use a Delphi TTable and jump to the last record it's not the last
ID
> - if we use Delphi SQL Explorer to look at the data, the records are not
> ordered by the primary key field
>
> The app is doing a lot of record appends, truncate tables etc.
> The app also runs on MS-SQL without problems, the code logic seems fine.
>
> What could be going on here?
> Is there such a thing as the index not being 'maintained' in Oracle?
>
> Thanks in advance for all suggestions
> Jan
>
>
>
Received on Wed Sep 19 2001 - 15:13:46 CDT

Original text of this message

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