Re: More on ORA-01722

From: Eric <eric_at_deptj.eu>
Date: Wed, 20 Mar 2013 23:00:48 +0000
Message-ID: <slrnkkkft0.ski.eric_at_teckel.deptj.eu>



On 2013-03-20, vsevolod afanassiev <vsevolod.afanassiev_at_gmail.com> wrote:
> I expect Oracle to use datatype conversion on the right side of equal
> sign:
> - It will prevent ORA-01722 error.

unless someone decides to write their equality comparison the other way round

> - If will ensure that if this column is indexed the index is used

> I don't think it requires artificial intelligence. Oracle has to use
> datatype conversion somewhere, either on the left or on the right. I
> don't see any advantages of using it on the left.

> Another option is to establish some ranking: a number can always be
> converted into a string but the opposite isn't true. So when comparing
> number to a string Oracle should convert this number into string instead
> of trying to convert string into number.

There _are_ rules about how implicit conversion is done, read the manuals. They don't involve anything as silly as left or right.

Anyway it is bad practice to rely on implicit conversions - we may all do it in quick ad-hoc queries but it should never survive into "production" code.

Eric

-- 
ms fnd in a lbry
Received on Thu Mar 21 2013 - 00:00:48 CET

Original text of this message