Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

when no rows returned in the for loop query, Replace Null - Need Help

627574Aug 19 2011 — edited Aug 19 2011
Hi,

I have a requirement where I have a query in the for loop and based on the query results, I am doing some operations.

But, even though the query does not have a match, I should return something like 'No Data'.

My for loop is:

FOR V_SL IN (
SELECT ID,CATEGORY,DI_CD,REV_CD,SL_ID
FROM SLOT_DATA SB, SLOT_2001 S2 WHERE
SB.BENEFIT_ID = S2.BENEFIT_ID AND
REV_CD = IN_REV_CD AND
(PROC_CD IS NULL OR PROC_CD = IN_PROC_CD)
ORDER BY DIAGCODE, PROCEDURECODE)
LOOP
END LOOP;

I am doing some operations inside the for loop. I want the loop to get executed even though the query doesn't return any rows.

Can anybody help me here.

Thanks,
Raghu
This post has been answered by kendenny on Aug 19 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2011
Added on Aug 19 2011
4 comments
1,404 views