You want to document your code with inline and multiline comments.
Place two dashes before any text to create a one-line comment. For example, in the following code there is a comment placed before the query to describe its functionality:
-- The following query obtains a count of rows from the employees table
SELECT COUNT(*)
FROM EMPLOYEES;
Multiline comments can be created beginning with a slash and asterisk (/*
) and ending with an asterisk and slash (*/
). The following lines depict a multiple-line comment for a given code block:
/* This comment describes the functionality
in the following code block. */
Comments play a crucial role in code development. Not only are they useful for commenting inline code to tip off future developers who may see the code, but they can also be useful to you when trying to debug some code you authored several years ago. It can be useful to place comments before any lines of code that may require some interpretation, and in some cases it is useful to place comments on the same line as code itself. The double dashes can be placed at any position in a line of code, and any text following the dashes becomes a comment. Here's an example:
DECLARE
emp_count NUMBER;
BEGIN
SELECT COUNT(*)
INTO emp_count -- Local variable
FROM EMPLOYEES;
END;
When PL/SQL sees a double dash, it ignores any text that follows for the remainder of the line. Similarly, when a /*
sequence is encountered, the interpreter ignores any lines of text until it encounters a closing */
.
13.58.248.90