Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Formatting SQL Query String
On Aug 27, 12:21 am, vitalis..._at_gmail.com wrote:
> On 27 août, 08:30, mpal <mpalk..._at_yahoo.com> wrote:
>
> > Hi Everyone,
>
> > I was wondering if someone could recommend a good utility / macro /
> > script that would read an SQL statement on input and produce the
> > same statement on output that would be formatted to be easy-to-read.
> > I.E. Inserting new lines, indentation, ... where appropriate.
>
> What is "where appropriate"? No tool can guess the meaning of your
> data.
> Please give at least an example. sqlplus might still be the best tool
> if properly configured.
O.K., I should perhaps be more clear with my question. The question is not about the data, it is about formatting the query.
I am using a reporting tool that automatically generates SQL statement
and sends it to Oracle.
For troubleshooting purposes, I need to understand the SQL that is
generated by the reporting tool.
The problem is that the generated SQL is not user-friendly formatted.
For example (illustrative example):
Generated SQL:
SELECT DISTINCT tab1.aaa, tab1.bbb, tab1.ccc FROM ( ( ( tabxxx INNER JOIN ( SELECT xxx.aaa, xxx.bbb FROM ...) b on xxx.aaa=b.aaa ... ) )... ) ...
What I would like to see:
SELECT DISTINCT
tab1.aaa, tab1.bbb, tab1.ccc FROM ( ( ( tabxxx INNER JOIN ( SELECT xxx.aaa, xxx.bbb FROM ... ) b on xxx.aaa=b.aaa ... ) )...
![]() |
![]() |