Re: Query capture

  • From: stephen booth <stephenbooth.uk@xxxxxxxxx>
  • To: breitliw@xxxxxxxxxxxxx
  • Date: Thu, 7 Apr 2005 19:46:28 +0100

On Apr 7, 2005 7:08 PM, Wolfgang Breitling <breitliw@xxxxxxxxxxxxx> wrote:
> Yes, I was wondering about that. I always use
> "elapsed_time/greatest(executions,1)" to avoid division by zero problems.
> 
> 
> Mohammad Rafiq wrote:
> 
> > Stephen
> >
> > Are you sure it ran successfully? I got error on a 9206 database on W2000.
> > Regards
> > and (a.elapsed_time/(1000000*a.executions)) > 5
> >                    *
> > ERROR at line 9:
> > ORA-01476: divisor is equal to zero

I ran it on 9206 on Solaris.  That error is basically saying that 
a.executions=0.  Thing is the preceding part of the where clause is
a.executions>0 so there should be no way a.executions=0.  The only
thing that comes to mind is that Oracle is trying to evaluate the
"(a.elapsed_time/(1000000*a.executions)) > 5" before the "a.executions
> 0".

You could change it to and
(a.elapsed_time/(1000000*greatest(a.executions,1))) > 5 but that
shouldn't be necessary.

I'm home now and don't have access to an Oracle server but I'll test
it again in the morning.

Stephen
-- 
It's better to ask a silly question than to make a silly assumption.
--
//www.freelists.org/webpage/oracle-l

Other related posts: