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

Home -> Community -> Usenet -> c.d.o.server -> Re: TO_NUMBER Problem

Re: TO_NUMBER Problem

From: Nuno Souto <nsouto_at_optushome.com.au.nospam>
Date: Wed, 20 Feb 2002 10:14:09 GMT
Message-ID: <3c7375e6.3467294@news-vip.optusnet.com.au>


Buck Turgidson doodled thusly:

>I am running the following code on an 8.1.6 database, and the join on
>two numeric fields (cal_year) only works with either a to_number or
>to_char function.
>

Buck:

if you take out explicit conversions in predicates, you'll find that Oracle will take default conversions. These can take any direction and/or priority and/or default depending on what version of the software you're talking about. Ie, Oracle will NOT guarantee that without explicit datatype conversions your SQL will always default the same way.

Bottom line: always (and I mean *ALWAYS*) make sure that if you have to compare two values of different datatypes, you do an explicit conversion to one of the datatypes. And if one of the values is a column name and the other a constant/variable/bind variable, then always convert the latter. Or else index use will suffer. But I digress...

Cheers
Nuno Souto
nsouto_at_optushome.com.au.nospam Received on Wed Feb 20 2002 - 04:14:09 CST

Original text of this message

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