Answer to Question #273373 in Databases | SQL | Oracle | MS Access for Dinny

Question #273373

Write the code solution using an explicit cursor with a simple Loop. Make sure to use your own variables.


1
Expert's answer
2021-11-30T07:15:04-0500
DECLARE  TYPE ref_cursor IS REF CURSOR;  
cur REF_CURSOR;  
d_item_no  items.item_no%TYPE;  
d_item_descr  items.item_descr%TYPE;
BEGIN  OPEN cur FOR 'SELECT i.item_no,    
                   i.item_descr            
      FROM ITEMS i               
  WHERE i.item_no in (1,2,3)'; 
 LOOP  
 FETCH cur INTO d_item_no, d_item_descr;   
 EXIT WHEN cur%NOTFOUND;   
dbms_output.put_line( d_item_no||' '||d_item_descr ); 
 END LOOP;  
CLOSE cur;
END;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS