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: sql

Re: sql

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Mon, 4 Oct 1999 13:43:36 +0200
Message-ID: <7ta3up$nu2$1@oceanite.cybercable.fr>


create or replace view myview as
 select col1, col2, decode(col2,0,0,(col1/col2)*1000000) col3  from mytable

--
Regards

Michel

<daud11_at_hotmail.com> a écrit dans le message : 7t9tka$n5p$1_at_nnrp1.deja.com...
> Hi
>
> I need to create a view where the code looks something like below.
>
> create or replace view myview as
> select col1, col2, (col1/col2)*1000000 col3
> from mytable
>
> However, it is possible that col2 contains some zero values and when
> there zeroes the view will break. I want col3 (calculated) to be 0 when
> col2 is 0. How do I change the sql to do just that with using UNION?
>
> Thanks
> Daud
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Oct 04 1999 - 06:43:36 CDT

Original text of this message

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