Re: Sort in Query

From: <sybrandb_at_hccnet.nl>
Date: Thu, 03 Jan 2008 20:15:30 +0100
Message-ID: <4ucqn35qjbldbqg11k4sf49988g467842p@4ax.com>


On Thu, 03 Jan 2008 16:16:26 +0100, Bram Mariën <bma_at_nospam.abiware.be> wrote:

>David,
>
>I understand that logic, but why is there a difference in the sort (both
>ASCII I assume) in the resultset of a query without a whereclause and the
>resultset of a query with a whereclause (INV_NR>'somevalue')
>
>If you do :
>WHERE INV_NR>'3307/0002' ORDER BY INV_NR
>I would assume Oracle returns me invoice_no 3307/0003, and not 33070001,
>because / < 0 ?
>
>Bram

You are comparing *strings* not numbers. As there is varchar2 column in the left hand side, and a string in the right hand side, there will be no implicit conversion. Also changes are your explain plan use the index, and the order by is suppressed.

You need to fix the mess, or learn to live with it.

-- 
Sybrand Bakker
Senior Oracle DBA
Received on Thu Jan 03 2008 - 13:15:30 CST

Original text of this message