SQL Script annotation syntax in Oracle DB
- REM Single line comment
- -- Single line comment
- /* Single line comment */
- /*
- Multi Line
- Comment
- */
Supplement: REM is short for REMARK.
So what is the difference between REM and?
-- Or/**/can be used for PL/SQL, but REM [ark] cannot.
The following section can be executed successfully in SQL * PLUS.
- REM comment
- -- Comment
- /* Comment */
- Begin
- DBMS_OUTPUT.PUT_LINE ('Test');-- Comment
- DBMS_OUTPUT.PUT_LINE ('Test');/* Comment */
- End;
- /
But the following section won't work.
- Begin
- DBMS_OUTPUT.PUT_LINE ('Test'); REM comment
- End;
- /
- Begin
- REM comment
- DBMS_OUTPUT.PUT_LINE ('Test');
- End;
- /
11.2 documentation on all comment types has a clear description of the annotations.
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.