11.1. Comments

The double hyphen (--) is used to comment a single line. A slash followed by an asterisk (/*) begins a block comment. An asterisk followed by a slash (*/) ends a block comment.

The C-style comments (/*, */) can be used to block out a section of code. The following procedure illustrates both forms.

-- Filename hello.sql
CREATE OR REPLACE PROCEDURE hello IS
    str CONSTANT VARCHAR2(15) := 'Hello World!';
    len INTEGER; /* length of the constant */
BEGIN
    --
    -- Set len to length of character string.
    --
    len := LENGTH(str);

    /*
    * write the string length
    */
    dbms_output.put_line(str||'-string length:'||len);
END hello;

Place comments after the CREATE statement, not before. This only applies if you are using a text editor with a tool like SQL*Plus—a ...

Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.