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: help for cursor

RE: help for cursor

From: Shetty, Diwakar <diwakar.shetty_at_credit-suisse.com>
Date: Mon, 26 Jun 2006 13:18:28 -0400
Message-ID: <FB9A739CA1DD3F4E81BF65BE4C6B0836279297AF@enyc19p32002.corpny.csfb.com>

 

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Nigel Thomas Sent: Monday, June 26, 2006 11:05 AM
To: xiaoyezi.xyz_at_163.com; oracle-l
Subject: Re: help for cursor

> The procedure 'test' is compiled successfully,but the result is:
> categories_cur%NOTFOUND is true
> which indicate no records in categories_cur,who can tell me why?
   

Your cursor loops through all results, then after the last fetch prints the 'not found' message; it's not doing anything with the data it does select. Add these lines and you'll see what I mean. NOTFOUND really means END OF FETCH...

BEGIN      
      OPEN categories_cur(p_name);
      LOOP
            FETCH categories_cur INTOv_describe;
            IF(categories_cur%NOTFOUND)
            THEN
               DBMS_OUTPUT.PUT_LINE('categories_cur%NOTFOUND is true');  
[Diwakar] I guess the above IF stmnt would cause
          an infinite loop. So instead it should be 
          "EXIT WHEN categories_cur%NOTFOUND"
            ELSE
               DBMS_OUTPUT.PUT_LINE(v_describe);
            END IF;   

END test;  

Regards Nigel  



Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html


--
http://www.freelists.org/webpage/oracle-l
Received on Mon Jun 26 2006 - 12:18:28 CDT

Original text of this message

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