Does IDEA support formatting of SQL statements?
When I try to format SQL statements in database console or some .sql file with <Ctrl>+<Alt>+<L> IDEA asks if I want to format the selection or the whole file. After that it does nothing.
It seems there is no formatting of SQL. Am I right?
My simple testcase is:
select * from d$tt737.t73vm173 where m173_pgm_id='we need more time'
After reformatting I expected to see something like:
select *
from d$tt737.t73vm173
where
m173_pgm_id='we need more time'
Instead I see:
select * from d$tt737.t73vm173 where m173_pgm_id='we need more time'
Helge
Please sign in to leave a comment.
Yes, please!
Rumors are DB/SQL support will be improved in Nika (IDEA 11), so this might be a good fit.
SQL formatting is surprisingly difficult, though.
I am using SQLinForm (sqlinform.com) for this and if you look at its options you get an idea of the complexity.
IMHO a great solution would be to integrate that formatter.
On 06.09.2011 10:35, Helge Walter wrote:
>
>
>
>
>
>
>
>
>
Some of my co-workers use SQLinform too but we have implemented a very simple formatter (that works fine without any settings).
Hi.
Some settings are provided in Settings / Code Style / SQL. And for me they turn your sample to:
select * from d$tt737.t73vm173
where m173_pgm_id='we need more time'
If you'd like to see more improvements, CRs are welcome: http://youtrack.jetbrains.net/issues/IDEA
Regards,
Alexander.
Sql formatting works if you specified sql dialect and doesn't work otherwise. So probably you have to select dialect in the console properties/in some other way.
regards, Alex
Hi Alex,
I hardly tried to select the 'IBM DB2' dialect but could not even find it ;-)
Regards, Helge
You could try to modify dialect in datasource settings either invoke ctrl+enter directly on your statement in console.But i'm sure it will help.
regards, Alex