Home » Other » Suggestions & Feedback » How to format your posts  () 2 Votes
How to format your posts [message #249573] Thu, 05 July 2007 01:37
Maaher
Messages: 7065
Registered: December 2001
Senior Member
If you are providing code snippets such as SQL*Plus copy/paste, please be sure to format your post. This means putting your code between the tags [code] and [/code]. Alternatively, you can just copy and paste your code in the topic, select the code and hit this button: http://www.orafaq.com/forum/theme/orafaq/images/b_code.gif. This will generate the tags for you.
It makes a huge difference to the forum readers. Unreadable code makes a question harder to understand and will delay answers. A lot of people don't spend that much time on the forum and unclear posts will be skipped more often because they take a lot more time to decypher.

The difference between the code blocks below is clear:

First a block without proper tags, you'll notice that it is not that readable
Declare
Cursor yourcursor
Is
Select yourcolumn
, another_column
From yourtable
Where some_column Between A And B
And some_other > SYSDATE;
Begin
For a_record In yourcursor
Loop
do_something_here;
If a_record.another_column = 1
Then
do_extra_stuff;
Else
do_other_stuff;
Else;
End Loop;
End;

And this block is the same, only now it is included in code tags. It distincts clearly the code from the other text and preserves text intending.
Declare
  Cursor yourcursor
      Is
  Select yourcolumn
       , another_column
    From yourtable
   Where some_column Between A And B
     And some_other  > SYSDATE;
Begin
  For a_record In yourcursor
  Loop
    do_something_here;
    If a_record.another_column  = 1
    Then
      do_extra_stuff;
    Else
      do_other_stuff;
    Else;
  End Loop;
End;


Scott Mackey (scottwmackey) has created a nice little document explaining in detail and with screencaps how to format. The document can be downloaded/viewed here.

A second point of attention is that you should provide your own table creation and insert script with sample data so others can easily recreate the table structure and provide you with an answer that is to the point.

But what if the code is not formatted itself? Code tags will do little about that. So you first have to format the code
  • by hand
  • via an external tool (like TOAD)
  • via the SQL Formatter page of OraFAQ.
Make sure that lines of code do not exceed 80 characters.

Thanks to Scott for the document.

The moderator staff

[Updated on: Mon, 27 August 2007 11:17] by Moderator

Report message to a moderator

Previous Topic: How to format your post
Next Topic: How to format your posts
Goto Forum:
  


Current Time: Sun Nov 24 08:36:49 CST 2024