Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It isn't the SQL !</p> <p>The perl code shows two loops. </p> <p>The outer loop is traversed for each entry in the @raw_data array. The value of each @raw_data 'record' is passed as the SITE_NAME parameter to a SELECT statement. </p> <p>You are executing multiple SELECT statements, one for each different site. Each individual SELECT returns an ordered row set, but they are all returning a single row for a single site. It is the order of the site names in the @raw_data array that is driving the order of the output.</p> <p>&lt;----------------------------------------------------------------------> Old entry which was totally misleading.</p> <p>I'll offer a few possibilities.</p> <p>(1) It is a bug. DISTINCT often, but not necessarily, does a sort to remove duplicates. It MAY have, for some reason, determined that the ORDER BY is redundant because of the query plan chosen.</p> <p>To determine this, check the query plan. EXPLAIN PLAN is simplest, but it is better to use DBMS_XPLAN.DISPLAY_CURSOR with the sql_id from v$sql for that SQL.</p> <p>(2) The data is being sorted but there is something causing the sort order to be other than what you expect. Try replacing PE_FQDN with DUMP(PE_FQDN) PE_FQDN. This will show the bytes that it is actually using.</p> <p>(3) the SELECT doesn't look exactly how you have said. For example</p> <pre><code>SELECT FRED BILL, BILL BILL_TOO FROM table ORDER BY BILL </code></pre> <p>will actually order by the column that has the alias BILL (which is the column FRED) and not by the column BILL.</p> <pre><code>SELECT FRED, BULL FROM table ORDER BY 'FRED' </code></pre> <p>will sort by the string 'FRED', not the value in the column FRED (and since everything is sorted by the same value, it won't actually do anything).</p> <p>&lt;--------------------------------------------------------------------------------------></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload