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: <saji.rajp_at_db.com>
Date: Tue, 18 Jul 2000 06:55:08 +0530
Message-Id: <10561.112227@fatcity.com>


Select count statement always returns a number whether there exists rows in the table or not.

If there are no rows the outcome is 1 row with count as 0. If there are some rows in the table output is 1 row with count of Number of rows. As always there is a row returned SQl %found is always TRUE So as per ur logic, it will always go to YES part...

Saji

From: pjohnpeter_at_qssnet.com on 18/07/2000 01:44

Please respond to ORACLE-L_at_fatcity.com

To: ORACLE-L_at_fatcity.com
cc:
Subject: sql%found problem

hi all,

   i had a problem over this query.could u tell me what is wrong in that query.



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. Received on Mon Jul 17 2000 - 20:25:08 CDT

Original text of this message

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