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: How To Trap No Rows Returned From Select Statement

Re: How To Trap No Rows Returned From Select Statement

From: Chris \( Val \) <chrisval_at_bigpond.com.au>
Date: Tue, 6 Jul 2004 18:32:51 +1000
Message-ID: <2kv6dbF6fq42U1@uni-berlin.de>

"Gabriele Lamon" <g.lamon.UGO_at_mcg-econ.it> wrote in message news:ccdk3b$38s$1_at_carabinieri.cs.interbusiness.it...
|
| "Chris Val" <chrisval_at_bigpond.com.au> ha scritto nel messaggio
| news:118880b0.0407051747.1e9cbdb7_at_posting.google.com...

Hi Lelle.

| > -- I would like to enter the exception handler if 'MethodName'
| > -- was not found in the select statement above, otherwise, if
| > -- rows were returned by the select statement, then display them.
| but above you have only "DECLARED" the cursor, no SQL operation has
| been executed
|
| > IF SQL%NOTFOUND THEN
| > RAISE MyException;
| > END IF;
| this doesn't work because you have to "OPEN" and "FETCH" the cursor to
| know if you have almost a row returned.

Yes, you're right - I should have known that.

| > DBMS_OUTPUT.ENABLE( 50000 );
| >
| i:=0;
| > FOR MyRow IN MyCursor LOOP
| > DBMS_OUTPUT.PUT_LINE( 'Line ' || MyCursor%ROWCOUNT || ': ' ||
| MyRow.TEXT );
| i := i + 1;
| > END LOOP;
[snip]

| > Thanks.
| Ni hao,
|
| > Chris Val
| Lelle.
|
| P.S.: Sorry for my english

Your English is fine, and thanks for the help - I see now where my erroneous thinking was :-).

Cheers.
Chris Val Received on Tue Jul 06 2004 - 03:32:51 CDT

Original text of this message

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