I need to make my output readable. I have succeeded in doing so, for queries that I write directly.
-
I need to do the same for queries that involve a cursor, i.e. to be specific, I need the records returned by a cursor to be formatted as well. But I am unable to do.
-
I instead explicitly print the column names, and the print the records. Still, the same. Is there any way, I could retrieve the headers as well, and then based on their length, format the received records as well?
If I understand you correctly, what you need is Dynamic Parsing and
lpad-rpadfunctions.With DBMS_SQL package, you can parse a SQL statement dynamically. I threw the code block below at the top of my head so there might be syntax errors, but it should give you the idea.
You also need to check the
lpad-rpadfunctions if you want to format your output. Try this and see for yourself: