Oracle Consulting Oracle Training Oracle Support Development
Oracle Books
SQL Server Books
IT Books
Job Interview Books
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle


Privacy Policy




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.
  7        Requirements:
  8        1.  v_string must be defined before    
  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

Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster

Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   



 Copyright © 1996 -2017 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks