610 pts.
 Formatting PL/SQL code in SQL Developer
Hi experts, I would like to know some keyboard shortcuts and clever formatting on PL/SQL codes in SQL Developer. Please help me out with some hints for this. Thanks in advance.

Software/Hardware used:
ASKED: February 19, 2009  5:49 AM
UPDATED: April 18, 2013  2:50 PM

Answer Wiki:
What version of SQL Developer are you using? They made enhancements to the SQL formatter in version 1.5 To see the available formatting options go to Tools->Preferences->Sql Formatter To check the current keyboard shortcut to format SQL go to Tools->Preferences->Accelerators, and look for "Format SQL". I think the default accelerator is Ctrl+B
Last Wiki Answer Submitted:  April 18, 2013  2:50 pm  by  Michael Tidmarsh   11,390 pts.
All Answer Wiki Contributors:  Michael Tidmarsh   11,390 pts. , carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

HI,

I need to understand the clever ways to format the PL/SQL ,not shortcuts …

 610 pts.

 

Hello ,

I found sqlinform a online version for formatting.

But is there direct means to get it properly done in sql developer itself

pls share ur thoughts

 610 pts.

 

I tried sqlinform, and I found it pretty similar to the sql formatter in Sql Developer (ver 1.5 or above). What exactly would you want to be able to do in Sql Developer that is possible in sqlinform but not in sql Developer ?

 63,535 pts.

 

BEGIN .. END blocks and IF .. then checks indentation within the block..

 610 pts.

 

I’m using version 1.5.3 and it does that, and much more.

You just need to select the desired code, and press Ctrl+F7 (this is the default shortcut), and it will automatically apply format including alignment and indentation, line breaks, white spaces, and others.

The formatter options are under Tools->preferences->Database->Sql Formatter.

If you are using an older version, I would recommend to download the latest.

Download Sql Developer 1.5.3 here.

 63,535 pts.

 

thanks yes even i am using 1.5.3,anyhow will check my formatting preference to have good formatting of my code

thanks once again.

 610 pts.

 

Use Tools->preferences->Database->Sql Formatter to customize how the formatter should format your code. The default formatting of SQL Developer is quite awkward, you can set it to your preference.

 10 pts.

 

Select the code block that you want to format, press F7, done

 10 pts.

 

@Carlosdl -> Thank you :)

 10 pts.

 

Help, I’m using it, but it put spaces between for example a htp.p text, making my code huge! How do I set it up to do not put line breakes between text lines?

 10 pts.

 

silvasofia:Go to “Tools”->”Preferences”->”Database”->”SQL Formatter”->”Oracle Formatting” and click the “Edit” button, then expand the “Line Breaks” item and make sure all checkboxes are unchecked.  Then click Ok twice, and try again.

 63,535 pts.