Is there any difference between Rem and -- comments for SQL*Plus?

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 */
begin
   DBMS_OUTPUT.PUT_LINE('Test'); --comment
   DBMS_OUTPUT.PUT_LINE('Test'); /* comment */
end; 
/

These will not:

begin
   DBMS_OUTPUT.PUT_LINE('Test'); REM comment
end; 
/

begin
   REM comment
   DBMS_OUTPUT.PUT_LINE('Test');
end; 
/

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.


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. ( http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt page 83 cf <comment introducer> ::= <minus sign><minus sign>[<minus sign>...] )