Oracle SQL - Comments in Scripts

Introduction

All scripts should contain minimal remarks to document the writer, the date, and the purpose of the report.

Remarks are called "comments" in other languages.

Remarks are allowable anywhere in the script except for within the SELECT statement.

Remarks start with REM in each line.

In the SELECT statement, normal comments may be used: /* comment */ or two dashes at the end of a single line.

Here is the above script with some remarks, indicated by REM:

Demo

SET echo off 
REM February 13, 2018 -- ww  w .j  a v  a  2  s.  com
REM Script for employee's current salary report 
COLUMN curr_salary FORMAT $9,999,999 
COLUMN ename FORMAT a10 
COLUMN region FORMAT a7 
BREAK ON region skip1 ON report 
REM 2 breaks - one on region, one on report 
COMPUTE sum max min of curr_salary ON region 
COMPUTE sum of curr_salary ON report 
REM a compute for each BREAK 
SET verify off 
SELECT empno, ename, curr_salary, region 
FROM employee 
ORDER BY region 
/ 
REM clean up parameters set before the SELECT 
CLEAR BREAKS 
CLEAR COMPUTES 
CLEAR COLUMNS 
SET verify on 
SET echo on

Related Topic