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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: sql%found problem

Re: sql%found problem

From: Sultan <ssyed_at_fine.co.ae>
Date: Tue, 18 Jul 2000 10:54:50 +0400
Message-Id: <10562.112235@fatcity.com>


This is a multi-part message in MIME format.

------=_NextPart_000_00EE_01BFF0A6.98E38C30 Content-Type: text/plain;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

  HAI PAUL,   The problem not with SQL%found ,problem with count function.

  If you use count function definitely it will return value Zero or more = than zero.
  It means SQL Stmt executed successfully and returning rows also,so It = will never go to 'No' section in your coding .

  By the way for your information
  If you used Count funtion in SQL Stmt You no need to define Exception = WHEN NO_DATA_FOUND since
  the count function never return no rows;

  Regards.
  SUL.   hi all,

     i had a problem over this query.could u tell me what is wrong in = that query.
  =3D=3D=3D=3D=3D=3D=3D=3D
  declare
  v number(10);
  begin
   select count(name) into v from str;
   if sql%found then

       dbms_output.put_line('yes '||v);
       else
       dbms_output.put_line('no '||v);
       end if;
       end;

  it displays only "yes'' even though the table contins or not contain = any rows.
  could u tellme what went wrong.
  paul
                                                =20

------=_NextPart_000_00EE_01BFF0A6.98E38C30 Content-Type: text/html;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE=20

style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: = 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>HAI PAUL,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>The problem&nbsp; not with SQL%found ,problem with =
count=20
  function.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>If you use count function definitely it will =
return=20
  value&nbsp;Zero or more than zero.</FONT></DIV>
<DIV><FONT size=3D2>It means SQL Stmt executed successfully and =
returning rows=20
  also,so It will never go to 'No' section in your coding .</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>By the way for your information</FONT></DIV>
<DIV><FONT size=3D2>If you used Count&nbsp; funtion in SQL Stmt You no =
need to=20
  define Exception&nbsp;WHEN NO_DATA_FOUND since</FONT></DIV>
<DIV><FONT size=3D2>the count function never return no =
rows;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>Regards.</FONT></DIV>
<DIV><FONT size=3D2>SUL.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000><FONT size=3D3>hi all,</FONT></FONT><FONT=20
  size=3D3></FONT></DIV>
<DIV><FONT color=3D#000000><FONT size=3D3>&nbsp;&nbsp; i&nbsp; had a =
problem over=20
  this query.could u tell me what is wrong in that = query.</FONT></FONT></DIV>
<DIV><FONT color=3D#000000><FONT =

size=3D3></FONT></FONT>=3D=3D=3D=3D=3D=3D=3D=3D</DIV>
<DIV>declare<BR>v number(10);<BR>begin<BR>&nbsp;select count(name) =
into v=20
  from&nbsp; str;<BR>&nbsp;if sql%found then<BR>&nbsp;&nbsp;&nbsp;&nbsp; =

  dbms_output.put_line('yes '||v);<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20   else<BR>&nbsp;&nbsp;&nbsp;&nbsp; dbms_output.put_line('no=20   '||v);<BR>&nbsp;&nbsp;&nbsp;&nbsp; end if;<BR>&nbsp;&nbsp;&nbsp;&nbsp; =

  end;</DIV>
<DIV>it displays only&nbsp;&nbsp; "yes'' even though the table contins =
or not=20
  contain any rows.</DIV>
<DIV>could u&nbsp; tellme what went wrong.</DIV>
<DIV>paul</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3D""=20
  =

size=3D3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 Received on Tue Jul 18 2000 - 01:54:50 CDT

Original text of this message

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