Oracle has some packages that will dump objects in SQL format, such as dbms_metadata.set_transform_param
. One option that can be set is to "pretty print" the SQL.
Is there anything in Oracle that will pretty print a random SQL query string? Something like:
select pretty_print('select * from emp;') sql from dual;
sql
---
'select *
from emp;'
DBMS_SQL.PARSE
to get it into the shared pool without executing it, then useDBMS_METADATA
to pretty print it. Obviously won't work if the statement won't parse in the current session due to missing objects. – Philᵀᴹ Mar 31 '15 at 8:14