Pular para o conteúdo

Fóruns Banco de dados Oracle Migração de 9i para 10g Migração de 9i para 10g

#89912
vieri
Participante

    Fábio vai ter que incluir o order by!

    Alegue para os desenvolvedores que não existe nada que pode ser feito…
    Eles deviam ter escrito em SQL ANCSI se quisessem nunca dar manutenção nesse sentido.
    faz parte do trabalho deles dar manutenção em código.

    O hint de ordenação a que vc se referiu é para ordernação de
    índices em joins, ou seja , qual ele irá ler 1°, para efeito de performance,
    nada haver com esse problema.

    ORDERED Hint

    The ORDERED hint instructs Oracle to join tables in the order in which they appear in the FROM clause. Oracle recommends that you use the LEADING hint, which is more versatile than the ORDERED hint.

    When you omit the ORDERED hint from a SQL statement requiring a join, the optimizer chooses the order in which to join the tables. You might want to use the ORDERED hint to specify a join order if you know something that the optimizer does not know about the number of rows selected from each table. Such information lets you choose an inner and outer table better than the optimizer could.

    The following query is an example of the use of the ORDERED hint:

    SELECT /*+ORDERED */ o.order_id, c.customer_id, l.unit_price * l.quantity
    FROM customers c, order_items l, orders o
    WHERE c.cust_last_name = :b1
    AND o.customer_id = c.customer_id
    AND o.order_id = l.order_id;