If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > how do retrive lob locator from procedure/function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-20-10, 07:40
duggirala_v duggirala_v is offline
Registered User
 
Join Date: Jan 2010
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 01-21-10, 12:08
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On