IBM Support

IC76485: DB2 DOESN'T RECOGNISE A NEW BEGIN-END BLOCK IMMEDIATELY AFTER A LABEL DECLARATION WHEN INTERPRETING PL/SQL

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as fixed if next.

Error description

  • When a BEGIN-END block follows immediately after a label
    declaration in a PL/SQL statement,
    e.g.
    
    -------
    CREATE OR REPLACE PROCEDURE PROC_TEST (
      ...
    ) IS
    
      ...
    
    BEGIN
        ...
        GOTO LABEL;
        ...
    << LABEL >>
        BEGIN
        ...
        END;
    END;
    -------
    
    db2 gives the following error:
    
    DB21034E  The command was processed as an SQL statement because
    it was not a
    valid Command Line Processor command.  During SQL processing it
    returned:
    SQL0104N  An unexpected token "BEGIN" was found following "BEGIN
    ".  Expected
    tokens may include:  "SELECT".  LINE NUMBER=XX.  SQLSTATE=42601
    

Local fix

  • Insert a NULL statement between the label and the BEGIN; e.g.
    
    << LABEL >>
        NULL;
    
        BEGIN
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * Interpreting PL/SQL in DB2                                   *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * When interpreting PL/SQL, DB2 does not recognise a BEGIN-END *
    * block that immediately follows a label.                      *
    *                                                              *
    * User will see a message like:                                *
    * DB21034E  The command was processed as an SQL statement      *
    * because it was n                                             *
    * valid Command Line Processor command.  During SQL processing *
    * it returned                                                  *
    * SQL0104N  An unexpected token "BEGIN" was found following "  *
    * BEGIN".                                                      *
    * Expected tokens may include:  "SELECT".  LINE NUMBER=XXX.    *
    * SQLSTATE=42601                                               *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 version 9.7 FP5                               *
    ****************************************************************
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    IC76485

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED FIN

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-05-18

  • Closed date

    2011-12-07

  • Last modified date

    2011-12-07

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

Applicable component levels

  • R970 PSN

       UP



Document information

More support for: DB2 for Linux, UNIX and Windows

Software version: 9.7

Reference #: IC76485

Modified date: 07 December 2011