Re: SQL Default Question (Resent)

From: Jim Kennedy <kennedy-downwithspammersfamily_at_attbi.com>
Date: Wed, 26 Feb 2003 04:38:51 GMT
Message-ID: <vxX6a.235850$SD6.11918_at_sccrnsc03>


That's because there isn't any data. You should put the select into a function that if an exception of no data found is raised in the function then return 0;
Jim
"abc" <abc_at_abc.com.au> wrote in message news:b3hega$skl$1_at_mws-stat-syd.cdn.telstra.com.au...
> Jim,
>
> The problem is my PL/SQL failed at SELECT clause like this
>
> ERROR at line 1:
> ORA-01403: no data found
> ORA-06512: at line ....
>
>
> "Jim Kennedy" <kennedy-downwithspammersfamily_at_attbi.com> wrote in message
> news:XNW6a.240189$tq4.5707_at_sccrnsc01...
> > How about
> > num2:=nvl(num2,0);
> > Jim
> > "abc" <abc_at_abc.com.au> wrote in message
> > news:b3hcvh$rrm$1_at_mws-stat-syd.cdn.telstra.com.au...
> > > Hi All,
> > >
> > > I have a PL/SQL to do following calculation:
> > >
> > > Total = NUM1 + NUM2;
> > >
> > > SELECT a INTO NUM1 FROM T1;
> > > SELECT b INTO NUM2 FROM T2;
> > >
> > > As b has no return row therefore NUM2 is undefined. Total as a
result
> > is
> > > also undefined (PL/SQL crashed with "No defined value ...")
> > >
> > > Is there any way to return b as ZERO if no row returned ???
> > >
> > > I have tried
> > >
> > > SELECT NVL(
> > > (SELECT b INTO NUM2 FROM T2), 0) FROM DUAL;
> > >
> > > But PL/SQL did not allow me to use SELECT ...(SELECT !
> > >
> > > SELECT NVL(NUM2,0) FROM DUAL doesn't work.
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
Received on Wed Feb 26 2003 - 05:38:51 CET

Original text of this message