Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On SQL*Plus prompt, both Rem and -- qualify as comment indicators:

Rem this is a comment
-- this is also a comment
create table emp (
id number primary key,
name cvarchar2(40));

Is there any difference at all between the two commenting techniques?

share|improve this question
And don't forget /* comment */ is valid too. – Gaius Jan 23 '11 at 21:44
up vote 13 down vote accepted

The difference is that -- and /* */ can be used in a PL/SQL block, while REM[ARK] cannot. The following will work in SQL*Plus:

REM comment
-- comment
/* comment */
   DBMS_OUTPUT.PUT_LINE('Test'); --comment
   DBMS_OUTPUT.PUT_LINE('Test'); /* comment */

These will not:

   DBMS_OUTPUT.PUT_LINE('Test'); REM comment

   REM comment

The 11.2 documentation on all comment types has more comment information. The basics are...

You can enter comments in a script in three ways:

  • using the SQL*Plus REMARK command for single line comments.

  • using the SQL comment delimiters /*... */ for single or multi-line comments.

  • using ANSI/ISO (American National Standards Institute/International Standards Organization) comments - - for single line comments.

The documentation also includes notes on four places that comments should not be used, but these do not include any further differences.

share|improve this answer
To be fair, I've never encountered a language that supports REM as a comment delimiter where those three letters aren't the first command characters on a given line (cf @REM in batch files) – jcolebrand Jan 24 '11 at 22:05
@jcolebrand Indeed. – Leigh Riffel Jan 25 '11 at 3:20

REM is supported due to being the way MS BATCH files are commented, and this tool being used with automation environments.

-- is supported due to being part of the SQL standard. ( page 83 cf <comment introducer> ::= <minus sign><minus sign>[<minus sign>...] )

share|improve this answer

No there should be no difference at all.

share|improve this answer
Why two comment styles then? – Lazer Jan 23 '11 at 21:37
@Lazer: backwards compatibility I expect – Gaius Jan 23 '11 at 21:45
I believe that REM is valid only for the tool SQLPlus, while -- and /**/ are coming from the language, they work also in MS SQL - TSQL for example. – Marian Jan 23 '11 at 21:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.