I have query written in sqldeveloper but I don\'t know how to align or format the query in neat order.
P.S: I don\'t know whether this question can be asked here. Kindly
right click on the query and then select "format"
Just right click, select FORMAT
option, or, use Ctrl + f7 shortcut to format. If you have not set your own formatting rules, then it would take the default formatting.
If you want to configure your own formatting, not many options though, go to Tools > Preferences > Code Editor > Display
You can also save it as your default format. So that even if you reinstall SQL Developer
, you can always point to the format file you saved earlier in your local machine.
For windows, CTRL + F7
For Mac, there is nothing from the OOTB. However, you can setup custom shortcut keys.
Preference -> Shortcut Keys
. Search for 'format' and assign the new shortcut key.
I had the same issue.
The steps I followed were:
Goto Tools > Preferences > SQL Formatter
Then Click Export and save the xml file. Now make changes however you like. Eg- I wanted 4 commas per line, so changed all 1 to 4 and used Ctrl + f7 to format.
Works well.
I have used Ctrl + f7 to format or align my query in sqldeveloper 4.7 with reference to the above comment from leo.