Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Location
    Madrid, Spain
    Posts
    3

    Post Unanswered: UDF, Recordset and Java

    Hi:

    It's possible pass a recordset as parameter to a Java UDF? I need make a SELECT FLAT(CONTS) FROM TABLE where FLAT is a UDF wich take de resultset of the consult and returns a String (or DB2 VARCHAR) whit the concatenation of the contents of CONTS.

    Thanks in advence

    P.D.: Sorry for my poor english

    Saludos:
    Nacho

  2. #2
    Join Date
    Jun 2002
    Location
    Madrid, Spain
    Posts
    3

    Okey guys:

    I've found one solution thanks to Using SQL Procedural Language for triggers in DB2 UDB by Paul Yip.

    Fortunately we have DB2 UDB Versión 7.2.2 where the trigger functionality has been significantly enhanced. So, at the moment, i needn't UDF nor stored procedure.

    This is the solution:

    CREATE TRIGGER SIC.TU004 AFTER UPDATE OF TITULO, DESCRIPCION_COMUN ON CEMI.SICA004
    REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL BEGIN ATOMIC
    DECLARE VARS LONG VARCHAR DEFAULT ' ';
    FOR C066 AS SELECT CONTENIDO FROM SIC.SICA066
    WHERE CLAVE_DOCUMENTO = N.CLAVE_DOCUMENTO AND
    CLAVE_IDIOMA = N.CLAVE_IDIOMA DO
    SET VARS = VARS CONCAT ' ' CONCAT C066.CONTENIDO;
    END FOR;
    INSERT INTO SIC.SICA034
    VALUES(N.CLAVE_DOCUMENTO,
    N.CLAVE_IDIOMA,
    N.TITULO CONCAT N.DESCRIPCION_COMUN CONCAT ' ' CONCAT VARS);
    END

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •