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