Call (800) 766-1884 for Oracle support & training
Free Oracle Tips


Oracle Consulting Support
Oracle Upgrades
Use New Oracle Features
Oracle Replication Support
Oracle Training
Remote Oracle DBA
System Documentation
Oracle Tips
Oracle Performance
 

Free Oracle Tips


 

HTML Text

BC Oracle tuning

Oracle training

Oracle support

Remote Oracle

 

 

   
  Oracle Tips by Burleson

PL/SQL Code Comments

PL/SQL  supports two types of comments.  If the commend is only one line, you can use the double hyphen (--) to mark a line as a comment.  Multiple lines can be commented by bracketing them with the slash star (/*…*/).

SQL> declare
  2    v_line varchar2(40);
  3  begin
  4    -- this is a single line comment
  5    v_line := 'Hello World';
  6    dbms_output.put_line (v_line);
  7    /*  This is a
  8        multiple line
  9        comment
 10    */
 11  end;/

Hello World

It has become common to document the code by adding comments that explain not only what the procedure  (function or block) does but also defines exactly what variables are passed and how they are changed.  This “self documented” code is invaluable in assisting someone who has to later maintain the code.  Here is a good example.

SQL> declare
  2    /*  This anonymous block uses a SQL*Plus
  3        variable as input, appends Hello to
  4        the front and writes it out to the
  5        buffer.
  6
  7        Requirements:
  8        1.  v_string must be defined before    
               execution
  9        2.  Must set serveroutput on to retrieve
 10            results
 11    */
 12    v_line varchar2(40):= '&v_string';
 13  begin
 14    v_line := 'Hello '||v_line;
 15    dbms_output.put_line (v_line);
 16  end;
 17  /

Enter value for v_string: Sammy

old  12:   v_line varchar2(40):= '&v_string';
new  12:   v_line varchar2(40):= 'Sammy';

Hello Sammy

Next, let’s look at variable declaration and manipulation.


The above book excerpt is from:

Easy Oracle PL/SQL Programming

Get Started Fast with Working PL/SQL Code Examples

ISBN 0-9759135-7-3   

John Garmany 

http://www.rampant-books.com/book_2005_1_easy_plsql.htm

  
 

Oracle performance tuning software 
 
 
 
 

Oracle performance tuning book

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

   

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.