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

Home -> Community -> Usenet -> c.d.o.misc -> Re: I want a TOO_MANY_ROWS error

Re: I want a TOO_MANY_ROWS error

From: Stéphane ROMANET <sromanet53_at_hotmail.com>
Date: Wed, 6 Nov 2002 14:51:23 +0100
Message-ID: <aqb742$rr9$1@news-reader10.wanadoo.fr>


If you do that SQL STATEMENT, that should happend ...

DECLARE
/* Declaration part */
  strField VARCHAR2(50);
BEGIN
/* Start the query */
select
  stef into strField
from
  (
/* Stupid UNION from dual, but just to ensure the result will be 2 records */

    select 'toto' as stef from dual
    UNION
    select 'tata' as stef from dual
  );
END; If the error doesn't happend in that case, maybe you have a magic Oracle ... ;)

Else, that should mean your query doesn't return more than 1 line ...

Regards

Stef
"sven" <sbraem_at_levi.com> a écrit dans le message de news: 48ca1f99.0211060249.346eb6c8_at_posting.google.com...
> Hi,
>
> As I can read in the documentation I should get an error when there is
> more then one row selected in a select into statement. Somehow I
> don't get the error and have to check for it and raise it myself.
> This is in Oracle forms 6i but that shouldn't make a difference right?
>
> select userid, password into v_userid, v_password
> from tmp_pw
> where userid = :txtusername;
> if SQL%ROWCOUNT > 1 then
> raise TOO_MANY_ROWS;
> end if;
>
> The table is filled with 2 of the same userid's. The selection puts
> the first row into the variables and that's it. If I don't check with
> %ROWCOUNT everything runs fine but it shouldn't.
>
> Is there something I didn't think of?
Received on Wed Nov 06 2002 - 07:51:23 CST

Original text of this message

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