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

Home -> Community -> Mailing Lists -> Oracle-L -> Order by queries against INSERT statements from procedures

Order by queries against INSERT statements from procedures

From: Jose Manuel Quesada <jose.manuelquesada_at_gmail.com>
Date: Fri, 10 Dec 2004 12:31:51 +0100
Message-ID: <dea875e40412100331384e610f@mail.gmail.com>


I have a temporary table filled with a statement like:

    INSERT INTO TEMP_TABLE

        SELECT A.ID, B.DATE_OPER, B.DATE_FIFO, B.AMOUNT T_AMOUNT
        FROM TABLE_A A, TABLE_B B
        WHERE A.ID = B.ID
        UNION ALL
        SELECT A.ID, C.DATE_OPER, C.DATE_FIFO, C.QUANTITY T_AMOUNT
        FROM TABLE_A A, TABLE_C C
        WHERE A.ID = C.ID;

I query the temporary table by means of an "order by" statement:
        SELECT * FROM TEMP_TABLE
        ORDER BY DATE_OPER, DATE_FIFO;

The issue is this:

1.- Every time I run the INSERT statement directly from SQL*PLUS, the "order by" query returns always with the same sequence of ordered rows sharing the same DATE_OPER, DATE_FIFO values.

2.- If I have the INSERT statement within a procedure, each time I run the procedure, the "order by" query may return a different sequence of ordered rows sharing the same DATE_OPER, DATE_FIFO values.

Any idea about this behaviour?

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Dec 10 2004 - 05:31:07 CST

Original text of this message

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