SQL Restrictions/Limitations

SQL statements must conform to a subset of ISO/ANSI standards common to all vendors. The basic standard used is DB2:

  • Use only statements SELECT, DELETE, INSERT, and UPDATE.

  • Always use the Fetch Function following a Select Statement, even when only one row is expected.

  • No SELECT INTO.

  • No SELECT FOR FETCH ONLY.

  • LONG VARCHAR columns are not supported.

  • Program (Host) variables must be preceded by a colon (":") and represented by numbers ascending from 1 (one) without gaps in the order of specification within the statement and without repetition of any number.

  • Code the stored SQL name for the select as the cursor name when using DELETE or UPDATE with positioning. For example: WHERE CURRENT OF CURSOR PSPRPRNT_S_CHECK

    Note:

    A separate SQL select with FOR UPDATE OF must be coded for DELETE and UPDATE with positioning in DB2.

  • The internal (COBOL) select list might be shorter than the external (SQL) select list. Only those columns identified internally are retrieved. An example where this is useful is the requirement that ORDER BY columns be included in the select list. Add the columns to the end of the SQL select list, but do not include in the COBOL source.