Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Looping over a table variable

$
0
0

I'd like to declare a cursor to loop over a table variable, something like this:

 

1.  DECLARE temp = SELECT a, b,c  from atable;

2.  DECLARE CURSOR cur FOR SELECT * FROM :temp;


This code, however, results in the error message on line 1:


     Syntax error. "=" is incorrect or misplaced.


Changing the code to this:

 

1.  temp = SELECT a, b,c  from atable;

2.  DECLARE CURSOR cur FOR SELECT * FROM :temp;


gives a different error message on line 2:

 

     Syntax error. "DECLARE" is incorrect or misplaced.


Is this possible? I was already thinking of moving the DECLARE cursor into a second procedure that is called from this one. But there must be a better way..



Viewing all articles
Browse latest Browse all 6412

Trending Articles



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