Add comments

You can add a comment to any line of an SPL routine, even a blank line.

To add a comment, use any of the following comment notation styles:
  • Place a double hyphen ( -- ) at the left of the comment.
  • Enclose the comment text between a pair of braces ( .. .} ).
  • Delimit the comment between C-style "slash and asterisk" comment indicators ( /* .. .*/).
To add a multiple-line comment, take one of the following actions:
  • Place a double hyphen before each line of the comment
  • Enclose the entire comment within the pair of braces.
  • Place /* at the left of the first line of the comment, and place */ at the end of the last line of the comment.
Braces as comment indicators are Informix® an extension to the ANSI/ISO standard for the SQL language. All three comment styles are also valid in SPL routines.

If you use braces or C-style comment indicators to delimit the text of a comment, the opening indicator must be in the same style as the closing indicator.

All the examples in the following figure are valid comments.
Figure 1: Valid comment examples.
SELECT * FROM customer -- Selects all columns and rows

SELECT * FROM customer
   -- Selects all columns and rows
   -- from the customer table

SELECT * FROM customer
   { Selects all columns and rows 
     from the customer table }

SELECT * FROM customer
   /* Selects all columns and rows 
     from the customer table */
Important: Braces ( { } ) can be used to delimit comments and also to delimit the list of elements in a collection. To ensure that the parser correctly recognizes the end of a comment or list of elements in a collection, use the double hyphen ( -- ) for comments in an SPL routine that handles collection data types.