Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

LOB locater from Java?

Ross MurrayApr 5 2005 — edited Apr 5 2005
I seem to be having a problem with getting a CLOB from a Java stored procedure. I have

public class TheJava {
...
public static CLOB getData(int arg){. . .

which is specified by

FUNCTION getClobData(a IN NUMBER)RETURN CLOB
AS LANGUAGE JAVA
NAME 'TheJava.getData(int) return oracle.sql.CLOB'

I also have the utility procedure to write it out

PROCEDURE printClobOut(result IN OUT NOCOPY CLOB) is
xmlstr varchar2(32767);
line varchar2(2000);
begin
xmlstr := dbms_lob.SUBSTR(result,32767);
loop
exit when xmlstr is null;
line := substr(xmlstr,1,instr(xmlstr,chr(10))-1);
dbms_output.put_line('| '||line);
xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
end loop;
end;

So if I try

declare
c CLOB;
begin
dbms_lob.createtemporary(c,true);
c:=getlegendasxml(1);
printclobout(c);
dbms_lob.freetemporary(c);
end;

I get

ORA-22275: invalid LOB locator specified
ORA-06512: at "SYS.DBMS_LOB", line 739
ORA-06512: at "PRINTCLOBOUT", line 5
ORA-06512: at line 6

Really, I have no idea what I have to do to get the right locater. Any suggestions are much appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2005
Added on Apr 5 2005
3 comments
185 views