Topic
  • 1 reply
  • Latest Post - ‏2013-07-15T06:29:32Z by Stony
LeeCotton
LeeCotton
1 Post

Pinned topic Error creating a new PL/SQL UDF with DataStudio 4.1 on Windows

‏2013-07-10T13:05:23Z |

Hi

I'm trying to create a new PL/SQL UDF using DataStudio 4.1. I've been through the wizard and selected one of the example templates:

"Deploy & Run: Return INTEGER" (opens a cursor and retrieves values from SYSIBM.SYSTABLES)

The SQL returned by the wizard is:

CREATE OR REPLACE FUNCTION TEST5
RETURN INTEGER
AS
VARCOUNT INTEGER := 0;
BEGIN
    -- ######################################################################
    -- # Returns all tables created by MAXIMO
    -- ######################################################################
    SELECT COUNT(*) INTO VARCOUNT FROM SYSIBM.SYSTABLES WHERE CREATOR = 'MAXIMO';
    RETURN VARCOUNT;
END;

If I then try and deploy it I get the following error:

Running
MAXIMO.TEST5 - Deploy started.
Create user-defined function returns SQLCODE: -104, SQLSTATE: 42601.
MAXIMO.TEST5: 4: An unexpected token "CREATE OR REPLACE FUNCTION TEST5
RETURN IN" was found following "BEGIN-OF-STATEMENT".  Expected tokens may include:  "<space>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.16.53
An unexpected token "CREATE OR REPLACE FUNCTION TEST5
RETURN IN" was found following "BEGIN-OF-STATEMENT".  Expected tokens may include:  "<space>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.16.53
MAXIMO.TEST5 - Deploy failed.
MAXIMO.TEST5 - Roll back completed successfully.

 

Can some one point out what I'm doing wrong?

 

Updated on 2013-07-10T13:05:32Z at 2013-07-10T13:05:32Z by LeeCotton
  • Stony
    Stony
    8 Posts

    Re: Error creating a new PL/SQL UDF with DataStudio 4.1 on Windows

    ‏2013-07-15T06:29:32Z  

    Hi,Lee,

    Please have a check, if you have enabled the "DB2_COMPATIBILITY_VECTOR"  for DB2?


    $ db2set
    DB2_COMPATIBILITY_VECTOR=ORA