SQL comments

Static SQL statements can include host language or SQL comments. Dynamic SQL statements can include SQL comments. There are two types of SQL comments:

simple comments
Simple comments are introduced by two consecutive hyphens.
bracketed comments
Bracketed comments are introduced by /* and end with */.

These rules apply to the use of simple comments:

These rules apply to the use of bracketed comments:

Example 1: This example shows how to include simple comments in a statement:

   CREATE VIEW PRJ_MAXPER         -- PROJECTS WITH MOST SUPPORT PERSONNEL
      AS SELECT PROJNO, PROJNAME  -- NUMBER AND NAME OF PROJECT
         FROM PROJECT
         WHERE DEPTNO = 'E21'     -- SYSTEMS SUPPORT DEPT CODE
         AND PRSTAFF > 1

Example 2: This example shows how to include bracketed comments in a statement:

   CREATE VIEW PRJ_MAXPER         /* PROJECTS WITH MOST SUPPORT
                                         PERSONNEL                */
      AS SELECT PROJNO, PROJNAME  /* NUMBER AND NAME OF PROJECT   */
         FROM PROJECT
         WHERE DEPTNO = 'E21'     /* SYSTEMS SUPPORT DEPT CODE    */
         AND PRSTAFF > 1


[ Top of Page | Previous Page | Next Page | Contents | Index ]