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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to select 0 as null

Re: How to select 0 as null

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 23 Jul 1999 16:06:10 +0100
Message-ID: <932742676.13736.0.nnrp-09.9e984b29@news.demon.co.uk>


Might be better to do:

    select

            decode( column_name, 0, to_number(null), column_name )     from t
    ;

other wise the column is coerced into a varchar2() column, and then anything you do to treat it as a number will require it to be coerced back to a number, so every row will have the overhead of one decode() one to_char() and one to_number() call.

Insignificant if the number of rows is only the odd hundred thousand, but could chew up some CPU when the data size becomes significant.

--

Jonathan Lewis
Yet another Oracle-related web site: www.jlcomp.demon.co.uk

Thomas Kyte wrote in message <37a77fbe.100930670_at_newshost.us.oracle.com>...
>
>select decode( column_name, 0, null, column_name )
> from t
>/
Received on Fri Jul 23 1999 - 10:06:10 CDT

Original text of this message

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