Adding Comments to Your SQL Script

SQL*Plus gives you three ways to place comments in your file:

  • -- places a comment on one line at a time.

  • REMARK also places a comment on one line at a time.

  • /* */ places a comment(s) on one or more lines.

Study the following example:

SQL> input
  1  REMARK this is a comment
  2  -- this is a comment too
  3  REM
  4  -- SET COMMANDS
  5  set echo on
  6  set feedback on
  7  -- SQL STATEMENT
  8  select *
  9  from products
 10
SQL>

To see how comments look in a SQL script file, type the following:

SQL> edit query10
					

Get Sams Teach Yourself SQL in 21 Days, Fourth 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.