Formatting PL/SQL code in SQL Developer

610 pts.
Tags:
Oracle PL/SQL
Oracle SQL
PL/SQL
PL/SQL block
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.

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 12  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Inprise
    HI, I need to understand the clever ways to format the PL/SQL ,not shortcuts ...
    610 pointsBadges:
    report
  • Inprise
    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 pointsBadges:
    report
  • carlosdl
    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 ?
    69,365 pointsBadges:
    report
  • Inprise
    BEGIN .. END blocks and IF .. then checks indentation within the block..
    610 pointsBadges:
    report
  • carlosdl
    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.
    69,365 pointsBadges:
    report
  • Inprise
    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 pointsBadges:
    report
  • Ranjanbs84
    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 pointsBadges:
    report
  • Hd21cn
    Select the code block that you want to format, press F7, done
    10 pointsBadges:
    report
  • Ndsaerith
    @Carlosdl -> Thank you :)
    10 pointsBadges:
    report
  • silvasofia
    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 pointsBadges:
    report
  • carlosdl
    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.
    69,365 pointsBadges:
    report
  • OracleAppsFinance
    ctrl+F7
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following