This content has been marked as final. Show 3 replies
user12033188 wrote:Cursors is not a PL/SQL concept. It is a SQL concept.
Is there any way to loop through or basically navigate through the values of a column(s) in SQL without using
PL/SQL features lik cursors.
To execute a SQL statement, requires the SQL engine to execute a SQL cursor. It is a fundamental construct in the SQL engine. There is no such concept as not using a cursor and executing SQL. You have one choice only. Cursors. There is no 2nd choice.
What you are referring to is row-by-row fetching the output of a cursor - using a PL/SQL loop. Yes, that approach is not ideal ito performance and scalability.
Whether PL/SQL is needed to process the output of a SQL cursor, or whether that processing complexity can be done entirely in the SQL itself depends on the requirements. What needs to be done? How complex is it?
Most times PL/SQL is not needed - as the SQL language is a powerful and flexible data processing language. But often the output of such a SQL cursor has to be used to do "something" - and that is typically where PL/SQL is used. E.g. write the cursor output as a HTML report table into an e-mail and mail that to a number of users.