Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010
    Posts
    2

    Unanswered: how do retrive lob locator from procedure/function

    Hello All,

    Can i write a procedure to get lob locator of a lob column?

    create table t1(i clob)@
    insert into t1 values('sample')@

    Now i want to get lob locator for this tuple.

    The following procedure will return the value "sample".
    Can i modify the OUT parameter to type to something else to return lob locator instead of actual lob value?

    CREATE procedure sample_function(
    OUT lob clob
    )
    LANGUAGE SQL
    READS SQL DATA
    BEGIN
    SELECT i INTO lob FROM t1;
    END @


    I guess there is a way to get lob locator using EMBEDDED SQL by doing something like this.
    SQL TYPE IS CLOB_LOCATOR lob;
    select i into lob from t1 ;
    return lob; ---syntax may be wrong, but i mean to say i am able to search in the net and finding ways through EMBEDDED SQL.

    Can i do it using function/procedure?

    Thanks in advance for the help.
    duggirala

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    A LOB locator is used when transferring a LOB out of DB2 (or into it). So you can use a locator in your application to access the OUT parameter of the procedure. You don't have to change anything in the procedure for that.

    Basically, you can completely ignore the concept of locators as long as you are working with LANGUAGE SQL stored procedures only.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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