Home » Other » Client Tools » Format Code (Toad for Oracle Base 10.5.1.3)
Format Code [message #602319] Tue, 03 December 2013 03:23 Go to next message
rc3d
Messages: 213
Registered: September 2013
Location: Baden-Württemberg
Senior Member
Hi

I use a lot the "Format Code" feature in Toad. See screenshot.

Now I see that pro Oracle guys format the code other:

Select rowid
     , xxx
     , xxxx
     , xxxxx
     , xxxxxx
     , xxxxxxx
FROM DUAL


Toad "Format Code" places the commas end of column name.

Is there a way to change "Format code"?

Re: Format Code [message #602323 is a reply to message #602319] Tue, 03 December 2013 03:52 Go to previous messageGo to next message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Yes,

Please go to View->Format options
Re: Format Code [message #602324 is a reply to message #602319] Tue, 03 December 2013 03:53 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Currently I use PL/SQL Developer for application development. However, complete formatting is done in Ultra-edit. By the way in TOAD or any other 3rd party tool you should have some settings file which can be used to keep the formatting and indentation per your development standards. However, at macro level I don't think it will be possible. So, it has to be done manually. TOAD doesn't know precisely your coding/development standards.
Re: Format Code [message #602348 is a reply to message #602319] Tue, 03 December 2013 04:44 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
rc3d
I see that pro Oracle guys

They do? Then I'm far from being a pro as I don't format code in that manner (which is OK, no problem). However, what substantial advantage do you see in
select col1
     , col2
from table
over
select col1,
       col2
from table
and what makes the first one "pro" formatting, while the other one is ... what, "amateur"?

I know one difference: it is easier to comment certain columns in the first example - you have to put "--" in front of the whole line, you don't have to pay attention to commas leading column names:
select col1
--   , col2            --> easy!
from table

vs.
select col1,           --> you have to remove comma 
--     col2
from table

Re: Format Code [message #602351 is a reply to message #602348] Tue, 03 December 2013 05:25 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Littlefoot wrote on Tue, 03 December 2013 10:44
rc3d
I see that pro Oracle guys


I know one difference: it is easier to comment certain columns in the first example - you have to put "--" in front of the whole line, you don't have to pay attention to commas leading column names:
select col1
--   , col2            --> easy!
from table

vs.
select col1,           --> you have to remove comma 
--     col2
from table


It's only easier for commenting the last column:
select --col1,         --> easy!
       col2
from table

select --col1          --> you have to remove comma 
     , col2   
form table


Which is why I never bother. As far as I'm concerned the benefit is illusionary and it's harder on the eyes.

If you really want this then I'm sure TOAD has settings for where the commas go. PL/SQL Developer certainly does.
Re: Format Code [message #602357 is a reply to message #602351] Tue, 03 December 2013 06:09 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
CM
It's only easier for commenting the last column:

Actually, for all columns but the first one:
select col1
--   , col2
     , col3
--   , col4
from table
Re: Format Code [message #602358 is a reply to message #602357] Tue, 03 December 2013 06:11 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
No - it's only easier for the last one. Columns in the middle work just the same with the comma on either side.
Re: Format Code [message #602360 is a reply to message #602323] Tue, 03 December 2013 06:47 Go to previous messageGo to next message
rc3d
Messages: 213
Registered: September 2013
Location: Baden-Württemberg
Senior Member
deepakmannazhi wrote on Tue, 03 December 2013 03:52
Yes,

Please go to View->Format options


thanks. But I see only error message.

Lalit Kumar B suggested I should switch to SQL Developer from Oracle? Toad is very expensive.. Is the free SQL Developer better? Does SQL Developer also support MySQL and Code Formating?
  • Attachment: bug.JPG
    (Size: 31.90KB, Downloaded 1225 times)
Re: Format Code [message #602366 is a reply to message #602360] Tue, 03 December 2013 08:44 Go to previous message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
rc3d wrote on Tue, 03 December 2013 18:17
Lalit Kumar B suggested I should switch to SQL Developer from Oracle?

I said I use PL/SQL Developer. It is a 3rd party tool. It has all those options which you might be looking for. I keep it in sync with ultraedit for format and indent. I have an oracle.uew file associated with ultraedit so that it understands the keywords etc. of my PL/SQL code. We do it because that's what is the application development standards being followed in my project.
Previous Topic: How to compare the two different explain plan in PL/SQL Developer
Next Topic: Do I need OracleMTSRecoveryService
Goto Forum:
  


Current Time: Thu Mar 28 21:09:17 CDT 2024