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: Why SQL%ROWCOUNT is returning 1 even when no records are foun

Re: Why SQL%ROWCOUNT is returning 1 even when no records are foun

From: Tom Pall <tom_at_cdproc.com>
Date: Sat, 4 Nov 2000 12:11:57 -0600
Message-Id: <10670.121155@fatcity.com>


Functions return a single value. You're expecting min to return two values, one of which is the number of rows processed. That violates the definition of a function.

> Tom,
>
> Thank you for taking time to answer the problem. I do agree with you on
> NO_DATA_FOUND clause and its actions in case of group functions.
> However, why SQL%ROWCOUNT is returning always 1 is not clear
>
> Thanks,
>
> Rao
>
> Maheswara.Rao_at_SunGardP3.com
>
> -----Original Message-----
> Sent: Friday, November 03, 2000 5:31 PM
> To: Multiple recipients of list ORACLE-L
>
> Correct.
>
> You are using it inappropriately here.
>
> This is from the pl/sql reference: "SQL group functions such as AVG and SUM
> always return a value or a null. So, a SELECT INTO statement that calls a
> group
> function will never raise NO_DATA_FOUND." So testing for %notfound won't
> work either.
> Looks like you'll have to change your query.
> ----- Original Message -----
> To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
> Sent: Friday, November 03, 2000 1:36 PM
>
> Hi All,
>
> Could any body help me in the following program problem. In the following
> program, SQL%ROWCOUNT is always returning 1 even when no record is found.
> We are stuck on this problem. We will be thankful for any light on why
> SQL%ROWCOUNT is returning 1 even when no records are found.
>
> create or replace procedure k2 is
> my_rowid varchar2(18);
>
> BEGIN
>
> select min(rowid) into my_rowid
> from messages_received
> where
> originator = 'blabla';
> dbms_output.put_line (sql%rowcount);
>
> end k2;
>
> /
>
> show errors;
>
> TIA
>
> Rao
>
> Maheswara.Rao_at_SunGardP3.com
>
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Rao, Maheswara
> INET: Maheswara.Rao_at_Sungardp3.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
Received on Sat Nov 04 2000 - 12:11:57 CST

Original text of this message

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