SQL Reference
Static SQL statements can include host language or SQL comments. SQL
comments are introduced by two hyphens.
These rules apply to the use of SQL comments:
- The two hyphens must be on the same line, not separated by a space.
- Comments can be started wherever a space is valid (except within a
delimiter token or between 'EXEC' and 'SQL').
- Comments are terminated by the end of the line.
- Comments are not allowed within statements that are dynamically prepared
(using PREPARE or EXECUTE IMMEDIATE).
- In COBOL, the hyphens must be preceded by a space.
Example: This example shows how to include comments
in an SQL statement within a C program:
EXEC SQL
CREATE VIEW PRJ_MAXPER -- projects with most support personnel
AS SELECT PROJNO, PROJNAME -- number and name of project
FROM PROJECT
WHEREDEPTNO = 'E21' -- systems support dept code
AND PRSTAFF > 1;
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]