Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8545

Issue with FOR loop in Nested BEGIN and END terminals

$
0
0

Hi All,

 

I am trying to fetch row by row using FOR loop on CURSOR.An i am getting Error attached screen shot:

 

Below is the logic:

 

Create Procedure TEST1() LANGUAGE SQLSCRIPT AS

BEGIN

 

AN01 = Select * from AN.View;

 

AN02 = SELECT DISTINCT F1,F2,F3 from :AN01 GROUP BY F1,F2,F3;

 

BEGIN

DECLARE CURSOR ITEM_RULE FOR select F1,F2,F3 from :AN02;

 

FOR V_ITEM_RULE AS ITEM_RULE DO

 

SELECT * from TABLE1 where F1 = V_ITEM_RULE.F1;

 

END FOR;

END;

 

END;

 

Here i an getting data from AN01..Then finding the Distinct in AN02.

On AN02 i am applying CURSOR...and for each row i wanted to find an entry in TABLE1 and do a calculation further.

  

-- But when i am using a FOR loop in the Nested BEGIN i am getting below Error.

   Screen Shot 2014-03-28 at 12.00.20.png

 

-- I tried to Activate successful without FOR Loop.

   Screen Shot 2014-03-28 at 12.02.21.png

 

Any Suggestion on the above issue.

 

Thanks

kalyan


Viewing all articles
Browse latest Browse all 8545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>