IBM Support

JR31534: DB2 MAY ISSUE AN SQL0901N WHEN EXECUTING A NON-ATOMIC SCALAR SQL UDF WITH A GLOBAL VARIABLE.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • An SQL0901N may be issued when executing a query containing an
    SQL UDF.
    .
    The following conditions must be satisifed for the SQL0901N to
    be issued:
    - The SQL UDF in question must be non-atomic and must only
    return a global variable.
    - The query containing the SQL UDF must contain an explicit
    reference to a base table.
    .
    An example of such a UDF and query follows:
    .
    -- Table DDL
    CREATE TABLE T1(C1 CHAR);
    INSERT INTO T1 (C1) VALUES ('A');
    .
    -- Global variable declaration
    CREATE VARIABLE PUBLIC_GV INTEGER DEFAULT 1;
    GRANT ALL ON VARIABLE PUBLIC_GV TO PUBLIC;
    .
    -- SQL UDF DDL
    CREATE FUNCTION FN_901() RETURNS INTEGER LANGUAGE SQL NOT
    DETERMINISTIC RETURN PUBLIC_GV;
    .
    -- Query that will issue the SQL0901N
    SELECT FN_901() FROM T1;
    .
    The SQL0901N issued will be:
    SQL0901N  The SQL statement failed because of a non-severe
    system error.
    Subsequent SQL statements can be processed.  (Reason "internal
    error: no or
    wrong dcl ".)  SQLSTATE=58004
    .
    This issue will be fixed starting with DB2 Version 9.5 Fix Pack
    4.
    

Local fix

  • If possible, rewrite the offending query to a semantically
    equivalent form that circumvents the conditions described above,
    e.g.,
    .
    -- Semantically equivalent queries that will circumvent the
    SQL0901N
    VALUES FN_901();
    SELECT FN_901() FROM SYSIBM.SYSDUMMY1;
    

Problem summary

  • Users Affected:  SQL Functions using global variables.
    Problem Description:
    An SQL0901N may be issued when executing a query containing an
    SQL UDF.
    .
    The following conditions must be satisifed for the SQL0901N to
    be issued:
    - The SQL UDF in question must be non-atomic and must only
    return a global variable.
    - The query containing the SQL UDF must contain an explicit
    reference to a base table.
    

Problem conclusion

  • First fixed in DB2 UDB Version 9.5, Fixpak 4
    

Temporary fix

  • see LOCAL FIX
    

Comments

APAR Information

  • APAR number

    JR31534

  • Reported component name

    DB2 UDB EXE WIN

  • Reported component ID

    5724E4901

  • Reported release

    950

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2008-12-22

  • Closed date

    2009-05-29

  • Last modified date

    2009-05-29

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

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

Fix information

  • Fixed component name

    DB2 UDB EXE WIN

  • Fixed component ID

    5724E4901

Applicable component levels

  • R950 PSN

       UP

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"950","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
12 October 2021