5

Is there any shortcut for formatting the query in plsql developer? I want to format below query:

SELECT * FROM T1, T2 WHERE T1.ID = T2.ID

like:

select 
  *
from
  T1, T2
WHERE
  T1.ID = T2.ID
mohammad_1m2
  • 1,571
  • 5
  • 19
  • 38
  • Yes, PL/SQL Developer has a PL/SQL beautifier, which does SQL too. [Find out more](https://www.allroundautomations.com/plsqldev.html). Be aware that it can't handle some rare SQL constructs. – APC Sep 10 '17 at 10:18
  • I'm not sure it can match your example exactly. For one thing, keywords can be set to either uppercase or lowercase, but not uppercase for `WHERE` and lowercase for `select` and `from`, if that is your rule. – William Robertson Sep 10 '17 at 12:28

7 Answers7

18

I am using version 12.0.7.

For this version, function name is not Edit / PL/SQL Beautifier

It is Tools / Source / PL/SQL Beautifier

It took some time for me to find it. I hope this help others.

enter image description here

enter image description here

Berk
  • 1,289
  • 12
  • 16
6

PL/SQL Developer does not have a default keyboard shortcut to launch the PL/SQL Beautifier but it is easy to configure one.

Open Tools --> Preferences, click on "Key Configuration", find the item "Edit / PL/SQL Beautifier", double-click on the empty space, click whatever keys you want to use for the shortcut, then click OK: enter image description here

You can also enable the PL/SQL Beautifier to run automatically: enter image description here

But be careful before you become too dependent on the code beautifier. They generally do not work well for Oracle SQL and PL/SQL. PL/SQL has a huge grammar and no code beautifier in existence can handle all types of code well. Also, dynamic code is much more important in PL/SQL than in other languages; beautifiers won't help with dynamic code so you'll likely need to manually format some code anyway.

Jon Heller
  • 34,999
  • 6
  • 74
  • 132
3

You must select your query and then click PL/SQL Beautifier button.

enter image description here

karmens89
  • 156
  • 5
2

For Ver. 12.07 you can click PL/SQL Beautifier button to format sql

enter image description here

bluetata
  • 577
  • 7
  • 12
1

Select your code and Use Ctrl-F7 on SQL Developer and PLSQL Developer as well.

Srimukh Y
  • 11
  • 1
0

The PL/SQL Beautifier allows you to format your SQL and PL/SQL code through a user-defined set of rules. Your code can automatically be beautified when you compile, save, or open a file.

Ganesh
  • 486
  • 3
  • 8
  • 18
  • I am using sql developer mac os version 18.1.0.0.5 see attach export file. I dont see beautify for my short cut key mapping is this a plug in I need to install ?? [https://docs.google.com/document/d/1mgHiGwWmzI8SOccT61TbFnYMgYXGgGySf9Gl3th4TVM/edit?usp=sharing] – Mookayama Jul 26 '18 at 00:54
0

If you want to customize PLSQL Beautifier, save your custom file on your PC and then import file and save it as picture below.

enter image description here