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

Re: EXEC Vs EXECUTE IMMEDIATE IN HANA?

$
0
0

Hi Sree,

 

Yes, you are right, in above example, you can display a result without using dynamic SQL construct.

 

But, what if in your above query, columns and order by statement are dynamic like mention below:


lv_sql_stat = 'SELECT ' || :col1 || ','||  :col2 || 'FROM tab ORDER BY '  || :lv_order_by || ';


You can run the above query using dymanic SQL as following two ways:

 

EXECUTE IMMEDIATE lv_sql_stat ;  => In this case, on calling the procedure, results of queries are appended to the procedures result iterator.


EXEC lv_sql_stat ; => In this case,on calling the procedures, you wont be able to see the result of the queries.


Hope this helps,


Best Regards,

Vaibhav





Viewing all articles
Browse latest Browse all 8902

Trending Articles



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