Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: insert query problem
I could be totally confused but Oracle does not control the order of the insert.
If a select clause is used the order is not used. The select clause does not use
the ORDER BY part.
Generally, the unique key is just that, a unique key.
If you want the records order in some sort of time sequence, I would suggest adding that. Note, Oracle only time down to the second. Often more than one record can be inserted in one second.
The other plan is to make the selection return only one record. Again the issue will be the fact that the records selected from any table is generally random. You could use a cursor which contains a order by clause.
Mike Krolewski
Peter ONeill wrote:
> INSERT INTO TABLE1
> (COL1,COL2,COL3)
> (SELECT
> COL1, COL2, COL3
> FROM TABLE2
> ORDER BY PRIMARY_KEY_COL)
>
> TABLE1 HAS A BEFORE INSERT TRIGGER THAT INSERTS PRIMARY KEY USING A
> SEQUENCE
> HOWEVER THE INSERT ORDER APPEARS TOTALLY RANDOM EVEN THOUGH I ADDED AN ORDER
> BY CLAUSE.
>
> IE TABLE 2 FIRST RECORD MIGHT BE 40TH RECORD IN TABLE 1 RATHER THAN FIRST
> RECORD.
>
> ANYONE KNOW WHAT THE PROBLEM IS?
>
> THANKS
> PETER
Received on Fri Apr 02 1999 - 01:36:10 CST
![]() |
![]() |