Navigation:  NexusDB Guide > SQL Reference > SQL Language Elements >

Comments

Previous pageReturn to chapter overviewNext page

NexusDB V3 Manual

Comments

button_main button_prev button_next

NexusDB Manual V3 > SQL Reference > SQL Language Elements

Comments are text embedded in SQL statements without being executed as part of the statement.

 

 

Simple comments

 

NexusDB SQL supports two variations of simple comments. The first variation, which is the syntax defined by SQL:2003, starts with two minus signs (--). The second variation, which is known from traditional programming languages like C and others, starts with two slashes (//). Simple comments can only appear in single lines and are terminated by the end of the line.

 

The following example illustrates the use of simple comments:

 

// The three pound symbols define a global temporary table

CREATE TABLE ###Temp (

      c1 AUTOINC NOT NULL PRIMARY KEY, -- We don't allow null values in this column

      c2 VARCHAR(50) // This is an ordinary character string column

)

 

 

Bracketed comments

 

Bracketed comments start with a slash followed by an asterisk and end with an asterisk followed by a slash. Bracketed comments can be embedded anywhere in an SQL statement and may span multiple lines.

 

The following example illustrates the use of bracketed comments:

 

/*

      SQL statements must be terminated with a semicolon when they're executed as a sequence (statement block).

      We need to drop the table before recreating it.

*/

 

/* The IF EXISTS clause prevents an exception if the table doesn't exist */

DROP TABLE IF EXISTS /*IF EXISTS is a NexusDB extension*/ ###Temp;

CREATE TABLE ###Temp (

      c1 AUTOINC NOT NULL PRIMARY KEY,

      c2 VARCHAR(50)

);

 

 


Conformance

 

SQL:2003 standard

 

 

NexusDB extensions

-

-

 

-

Core SQL

Feature T351 "Bracketed comments"

 

C-style comments

 

© Nexus Database Systems Pty Ltd.

nexus_logo