Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Querying a number column.
robertsboyle wrote:
> Mattias is correct..running under 9.2 i get the following..
>
> Elapsed: 00:00:00.02
> robert_at_DEV1>create table t (mynumber number);
>
> Table created.
>
> Elapsed: 00:00:00.00
> robert_at_DEV1>create index x_t_mynumber on t(mynumber);
>
> Index created.
>
> Elapsed: 00:00:00.00
> robert_at_DEV1>insert into t values (1);
>
> 1 row created.
>
> Elapsed: 00:00:00.00
> robert_at_DEV1>insert into t values (2);
>
> 1 row created.
>
> Elapsed: 00:00:00.00
> robert_at_DEV1>set autotrace on explain
> robert_at_DEV1>select *
> 2 from t
> 3 where mynumber = '1';
>
> MYNUMBER
> ----------
> 1
>
> Elapsed: 00:00:00.00
>
> Execution Plan
> ----------------------------------------------------------
> SELECT STATEMENT Optimizer=CHOOSE
> 1 0 INDEX (RANGE SCAN) OF 'X_T_MYNUMBER' (NON-UNIQUE)
>
> robert_at_DEV1>select *
> 2 from t
> 3 where mynumber = 1;
>
> MYNUMBER
> ----------
> 1
>
> Elapsed: 00:00:00.00
>
> Execution Plan
> ----------------------------------------------------------
> SELECT STATEMENT Optimizer=CHOOSE
> 1 0 INDEX (RANGE SCAN) OF 'X_T_MYNUMBER' (NON-UNIQUE)
>
> robert_at_DEV1>select *
> 2 from t
> 3 where mynumber = to_number('1');
>
> MYNUMBER
> ----------
> 1
>
> Elapsed: 00:00:00.00
>
> Execution Plan
> ----------------------------------------------------------
> SELECT STATEMENT Optimizer=CHOOSE
> 1 0 INDEX (RANGE SCAN) OF 'X_T_MYNUMBER' (NON-UNIQUE)
>
> Robert.
>
> --
> Posted via http://dbforums.com
I don't understand why anyone is checking to see if anything is correct or not when the code is directly in violation of Oracle's recommendation about NOT using implicit conversion.
Write good code and it works. Write bad code and you get what you deserve.
Daniel Morgan Received on Fri Jan 24 2003 - 13:17:23 CST
![]() |
![]() |