Path: news.easynews.com!core-easynews!newsfeed1.easynews.com!newsfeed2.easynews.com!easynews.com!easynews!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail
From: Norman Dunbar <Oracle@MSSQLBountifulSolutions.co.uk>
Newsgroups: comp.databases.oracle.server
Subject: Re: Division by zero: how to handle?
Date: Fri, 06 Jun 2003 07:48:18 +0100
Lines: 41
Message-ID: <bbpdcj$s54$1$8300dec7@news.demon.co.uk>
References: <xmmDa.5737$lL2.90362@news.chello.at> <E2F6A70FE45242488C865C3BC1245DA703BED690@lnewton.leeds.lfs.co.uk> <20030605114614.823$4y@newsreader.com>
Reply-To: Oracle@MSSQLBountifulSolutions.co.uk
NNTP-Posting-Host: bountiful.demon.co.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
X-Trace: news.demon.co.uk 1054882004 28836 194.222.119.227 (6 Jun 2003 06:46:44 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Fri, 6 Jun 2003 06:46:44 +0000 (UTC)
User-Agent: KNode/0.7.2
Xref: core-easynews comp.databases.oracle.server:188818
X-Received-Date: Thu, 05 Jun 2003 23:49:11 MST (news.easynews.com)

ctcgag@hotmail.com wrote:


> Is there something like that for within a single query?
> 
> select 1/(rownum-5) from tab;  -- as a user with > 5 tables
> 
> The whole query aborts, rather than just ignoring the row that would have
> an error.
> 

Morning Xho,

how about using decode as another poster mentioned :

select 1/decode((rownum-5), 0, Something, (rownum-5)) from tab;


SQL> select rownum,1/decode((rownum-5),0,1e12,(rownum-5)) from hr.employees
  2* where rownum < 10

    ROWNUM 1/DECODE((ROWNUM-5),0,1E12,(ROWNUM-5))
---------- --------------------------------------
         1                                   -.25
         2                             -.33333333
         3                                    -.5
         4                                     -1
         5                             1.0000E-12
         6                                      1
         7                                     .5
         8                             .333333333
         9                                    .25

9 rows selected.


Cheers,
Norman.

-- 
Remove a certain other database to reply :o)
