DBMS_LOB.CONVERTTOBLOB invalid LOB locator specified: ORA-22275
Hi all,
the following code has been working great on 11g (and apex.oracle.com)
now when I try to use this function under 10g XE
I get following error :
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 696
ORA-06512: at "RIGHTSHOP.C2B", line 14line 14 being the line with DBMS_LOB.CONVERTTOBLOB
any ideas ?
CREATE OR REPLACE FUNCTION c2b( p_clob IN CLOB )
RETURN BLOB
is
temp_blob BLOB;
dest_offset NUMBER := 1;
src_offset NUMBER := 1;
amount INTEGER := dbms_lob.lobmaxsize;
blob_csid NUMBER := dbms_lob.default_csid;
lang_ctx INTEGER := dbms_lob.default_lang_ctx;
warning INTEGER;
BEGIN
DBMS_LOB.CREATETEMPORARY(lob_loc=>temp_blob, cache=>TRUE);
DBMS_LOB.CONVERTTOBLOB(temp_blob, p_clob,amount,dest_offset,src_offset,blob_csid,lang_ctx,warning);
return temp_blob;
END;Kr
Martin
Can't reproduce
SQL> CREATE OR REPLACE FUNCTION c2b( p_clob IN CLOB )
RETURN BLOB
is
temp_blob BLOB;
dest_offset NUMBER := 1;
src_offset NUMBER := 1;
amount INTEGER := dbms_lob.lobmaxsize;
blob_csid NUMBER := dbms_lob.default_csid;
lang_ctx INTEGER := dbms_lob.default_lang_ctx;
warning INTEGER;
BEGIN
DBMS_LOB.CREATETEMPORARY(lob_loc=>temp_blob, cache=>TRUE);
DBMS_LOB.CONVERTTOBLOB(temp_blob, p_clob,amount,dest_offset,src_offset,blob_csid,lang_ctx,warning);
return temp_blob;
END; 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17 /
Function created.
SQL> declare
2 b blob;
3 c clob;
4 begin
5 c := 'x';
6 b := c2b (c);
7 end;
8 /
PL/SQL procedure successfully completed.
SQL> and my version (also XE)
SQL> select *
2 from v$version
3 /
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Similar Messages
-
"ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275"
I use the procedure to convert the documents if it is not already converted before using procedure as follows
PROCEDURE "STARDOC"."HTMLOUTPUT" (
"DOCID" IN NUMBER) IS
mklob clob;
doccount number;
errorcode number;
errormessage varchar2(200);
BEGIN -- executable part starts here
SELECT COUNT(document_id) INTO doccount FROM docviewhtml where document_id=docid;
--dbms_output.put_line(doccount);
if doccount=0 then
dbms_output.put_line('Document Not Found: Converting '||docid);
--If document is not found run document coversion routine
ctx_doc.filter('idxdocuments',docid, mklob,FALSE);
INSERT INTO docviewhtml(document_id, html) VALUES (docid, mklob);
COMMIT;
elsif doccount=1 then
--return;
dbms_output.put_line('Document Found');
--if document id found then return the document content
null;
else
--dbms_output.put_line('Error occured');
--need to deal with duplicate documents
null;
end if;
dbms_lob.freetemporary(mklob);
EXCEPTION
--rollback when an exception occurs
WHEN OTHERS THEN
errorcode:=SQLCODE;
errormessage:=SQLERRM;
dbms_output.put_line(sqlcode || ':' ||sqlerrm);
ROLLBACK;
LOGERROR(errorcode,errormessage);
END "HTMLOUTPUT";
i get the error when i convert large documents
"ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275"
what is wrong. please help!"ORA-06502: PL/SQL: numeric or value error: invalid
LOB locator specified: ORA-22275"
PROCEDURE "STARDOC"."HTMLOUTPUT" (
"DOCID" IN NUMBER) IS
mklob clob;
ctx_doc.filter('idxdocuments',docid, mklob,FALSE);
INSERT INTO docviewhtml(document_id, html) VALUES (docid, mklob);I think You forget to initialize variable mklob.
You can do it, assigning the empty_clob(). -
ORA-22275: invalid LOB locator specified on trigger
I have a trigger which copies a blob on insert to one table to another.
CREATE OR REPLACE TRIGGER SWZTPRO.TSWTMPI_BEFORE_INSERT
BEFORE INSERT
ON SWZTPRO.TO_TSWTMPI
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
discriminator TO_TSWCRUL.BTC_DIS%TYPE;
discriminator:=:NEW.BTC_DIS;
insert into .....
If using after insert this triggerworks, but if the trigger fails for any reason, the client does not recieve the error.
If using before insert this fails:
insert into table, use before insert trigger
ORA-22275: invalid LOB locator specified
ORA-06512: at "SWZTPRO.TSWTMPI_BEFORE_INSERT", line 108
ORA-22275: invalid LOB locator specified
ORA-04088: error during execution of trigger 'SWZTPRO.TSWTMPI_BEFORE_INSERT'
Any help would be appreciatedI have also used a varaiation tirgger to do an instead of on insert on a view and I get the following error:
ORA-25008: no implicit conversion to LOB datatype in instead-of trigger -
ORA-22275: invalid LOB locator specified
Hello,
I use Oracle 11.2.0.3. APEX 4.2.2... Listener 2.0.3 .... Glassfish server 4.0.
When I run this procedure ( that is used in this tutorial )
I get ORA-22275: invalid LOB locator specified.
The error persists over Glass fish 3.0.2, Listener 2.0.1 and 2.0.2.
Also, I installed this patch 16803775, but to not avail.
declare
v_mime VARCHAR2(48);
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BLOB;
BEGIN
SELECT MIMETYPE, CONTENT, filename,DBMS_LOB.GETLENGTH(content)
INTO v_mime,lob_loc,v_file_name,v_length
FROM image
WHERE id = 70;
htp.init;
-- set up HTTP header
-- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from windows
owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
-- set the size so the browser knows how much to download
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
-- close the headers
owa_util.http_header_close;
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
end ;
Any help pls, in getting that procedure works ?
Regards,
Fatehreplace this statement
select empty_clob() into c_xml from dual for update;
with
dbms_lob.createtemporary(c_xml, TRUE); -
ORA-22275 :invalid LOB locator specified error while loading BLOBs/CLOBS.
Hello All,
I am trying to load BLOB/CLOB data from a client oracle DB to the oracle db on our side,we are using ODI version 10.1.3.5.6,which reportedly has the issue of loading BLOB/CLOBS solved.I am using
The extraction fails in the loading stage when inserting data into the C$ table with the following error.
"22275:99999 :java.sql.BatchUpdateException:ORA-22275:Invalid LOB locator specified".
Kindly let me know how I can resolve this issue as the requirement to load this data is very urgent.
Thanks,
JohnOne alternate way can be done out of ODI as ODI is still not able to resolve this issue. You can trim these fields (CLOB/BLOB) and push this data as separate fields into ODI and at the reporting end you can again concatenate them.
May be this may solve your problem ....it solved mine.
--XAT -
Oracle 11g - Error ORA-22275: invalid LOB locator specified
Getting error during oBlob.freeTemporary() as
clearBlobValues() throws Exception
oracle.sql.BLOB oBlob = oset.getBLOB(i);
oBlob.freeTemporary();
I googled this error and get some solution
"Cause: There are several causes: (1) the LOB locator was never initialized; (2) the locator is for a BFILE and the routine expects a BLOB/CLOB/NCLOB locator; (3) the locator is for a BLOB/CLOB/NCLOB and the routine expects a BFILE locator; (4) trying to update the LOB in a trigger body -- LOBs in trigger bodies are read only; (5) the locator is for a BFILE/BLOB and the routine expects a CLOB/NCLOB locator; (6) the locator is for a CLOB/NCLOB and the routine expects a BFILE/BLOB locator;
Action: For (1), initialize the LOB locator by selecting into the locator variable or by setting the LOB locator to empty. For (2),(3), (5) and (6)pass the correct type of locator into the routine. For (4), remove the trigger body code that updates the LOB value."
but not sure how to go about this. Can anyone lends a helping hand?
Thanx in advance
Edited by: user13503846 on Sep 7, 2011 10:16 AMYou should try to post a small but complete example that allows to reproduce the issue with:
1. your 4 digits Oracle version (client and server)
2. the language you are using. -
ORA-22275: invalid LOB locator specified in a function
Hello all!!!
I am having a little problem with a function that returns a blob... When I call the function, I get that error... Here is the function (I took all the exception management code to clear it up a little...)
<CODE>
FUNCTION f_getfileblob (p_id IN NUMBER,
p_application IN VARCHAR2,
p_subject IN VARCHAR2)
RETURN BLOB
IS
v_table_name VARCHAR2(50);
v_sql_string VARCHAR2(1000);
lobfile BLOB := empty_blob();
v_error NUMBER;
BEGIN
SELECT TABLE_NAME INTO v_table_name FROM ORACLE_TEXT_FILE WHERE APPLICATION = p_application AND SUBJECT = p_subject;
v_sql_string := 'SELECT FILE_BLOB FROM ' || v_table_name || ' WHERE id = :1';
EXECUTE IMMEDIATE v_sql_string INTO lobfile USING p_id;
RETURN lobfile;
END;
</CODE>
So, in this function, the first select is to find the name of the table in which I store my blobs (I'm trying to do something generic and cross application). Once I have that name, I can do the select of the blob. I can only use dynamic SQL because of the table name that is not known in advance.
I tried this function with
DBMS_LOB.CREATETEMPORARY(LOBFILE, TRUE, DBMS_LOB.CALL);
to create the lob at the begining, but this returns another error... (i tried with and without the initialisation of the blob, empty_blob())
ORA-24801: illegal parameter value in OCI lob function. But I don't even know if it would help...
Can somebody please help me?
Thanks and best regards
Neil.Sorry about that, error came from elsewhere...
Thanks anyway
Best regards
Neil. -
ORA-22275: invalid LOB locator specified problem
Hi
Can anybody point me in the right direction.. I am NOT using clob and blob anywhere in my operation.. All I am doing is plain inserts from arrays.. and it gives me this error.
Here is the code:
Connection conn = null;
Statement stmt = null;
PreparedStatement ps = null;
CallableStatement cs= null;
ResultSet rs = null;
Connection conn1 = null;
Statement stmt1 = null;
CallableStatement cs1= null;
ResultSet rs1 = null;
conn = DataSrc.getDataSource().getConnection();
stmt =conn.createStatement();
conn1 = DataSrc.getDataSource().getConnection();
stmt1 =conn1.createStatement();
rs = stmt.executeQuery(sql1);
while (rs.next()) {
var10 = rs.getString(1);
cs=conn.prepareCall("{call proc1}");
cs.execute();
cs.close();
stmt = conn.createStatement();
ps = conn.prepareStatement(sql);
for (int pl = 0; pl < ij; pl++) {
var2 = array1[pl];
var3 = array2[pl];
var4 = array3[pl];
var5 = array4[pl];
var6 = “ABC”;
var7 = “ABC”;
var8 = array8[pl];
var9 = “ABC”;
var1 = var2.substring(0,6);
var2 = var2.substring(var2.length()-1);
var3 = var3.replace("'","");
if (var9.length()<5) {
var9 = "00" + var9;
if (var9.length()<6) {
var9 = "0" + var9;
String sql2 = "xxxxxx";
rs1 = stmt1.executeQuery(sql2);
while (rs1.next()) {
var11 = rs1.getString(1);
if (!var2.equals(var8)) {
ps.setString(1, var1);
ps.setString(2, var2);
ps.setString(3, var3);
ps.setString(4, var4);
ps.setString(5, var5);
ps.setString(6, var6);
ps.setString(7, var7);
ps.setString(8, var8);
ps.setString(9, var9);
ps.setString(10, var10);
ps.setString(11, var11);
ps.executeUpdate();
ps.close();
cs=conn.prepareCall("{call xxxxxxxxx}");
cs.execute();
cs.close();
stmt.executeUpdate("COMMIT");
stmt.close();
conn.close();
rs1.close();
stmt1.close();
conn1.close();cs=conn.prepareCall("{call proc1}");
cs=conn.prepareCall("{call xxxxxxxxx}");check those procedures, might be invloved clob and blob operation.... -
I've tried to append couple of BLOB fields from one table and then update it to a record in another table. I got the following error. Does anyone know why?
CHECK POINT 1
begin
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified:
ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 753
ORA-06512: at "RBSSDEV.PG_TB_COMMENT_DETAIL", line 57
ORA-06512: at line 2
My store procedure is :
PROCEDURE SP_Insert_Comment_Detail
( v_CommentOID IN TB_COMMENT_DETAIL.COMMENTOID%TYPE ,
v_DBName IN TB_COMMENT_DETAIL.DBNAME%TYPE ,
v_ApplicationOID IN TB_COMMENT_DETAIL.APPLICATIONOID%TYPE ,
v_Comments IN TB_COMMENT_DETAIL.COMMENTS%TYPE ,
v_Created IN TB_COMMENT_DETAIL.CREATED%TYPE ,
v_UserID IN TB_COMMENT_DETAIL.USERID%TYPE
IS
lv_CommentsBlob BLOB := EMPTY_BLOB;
lv_CommentBlob BLOB := EMPTY_BLOB;
lv_NewComment VARCHAR2(1) := 'N';
CURSOR CommentDetail_cur IS
SELECT Comments
FROM TB_COMMENT_DETAIL
WHERE CommentOID = v_CommentOID
ORDER BY RecDate, DBName;
CURSOR Comment1_cur IS
SELECT Comments
FROM COMMENT1
WHERE CommentOID = v_CommentOID FOR UPDATE;
BEGIN
DBMS_LOB.CreateTemporary(lv_CommentBlob, TRUE, DBMS_LOB.CALL);
OPEN CommentDetail_cur;
FETCH CommentDetail_cur INTO lv_CommentBlob;
IF CommentDetail_cur%NOTFOUND THEN
lv_NewComment := 'Y';
END IF;
CLOSE CommentDetail_cur;
INSERT INTO TB_COMMENT_DETAIL
(CommentOID, RecDate, DBName, ApplicationOID,
Comments, Created, UserID)
VALUES
(v_CommentOID, SYSDATE, v_DBName, v_ApplicationOID,
v_Comments, v_Created, v_UserID);
IF lv_NewComment = 'Y' THEN
INSERT INTO Comment1
VALUES (v_CommentOID, v_ApplicationOID, v_Comments, v_Created, v_UserID);
COMMIT;
ELSE
DBMS_LOB.CreateTemporary(lv_CommentBlob, TRUE, DBMS_LOB.CALL);
DBMS_LOB.CreateTemporary(lv_CommentsBlob, TRUE, DBMS_LOB.CALL);
OPEN Comment1_cur;
FETCH Comment1_cur INTO lv_CommentsBlob;
-- Empty the Comments field of the Comment1 table
IF Comment1_cur%FOUND THEN
DBMS_OUTPUT.PUT_LINE('CHECK POINT 1');
DBMS_LOB.TRIM(lv_CommentsBlob, 0);
DBMS_OUTPUT.PUT_LINE('CHECK POINT 2');
END IF;
OPEN CommentDetail_cur;
LOOP
FETCH CommentDetail_cur INTO lv_CommentBlob;
EXIT WHEN CommentDetail_cur%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('CHECK POINT 3');
DBMS_LOB.APPEND(lv_CommentsBlob, lv_CommentBlob);
DBMS_OUTPUT.PUT_LINE('CHECK POINT 4');
END LOOP;
COMMIT;
CLOSE Comment1_cur;
CLOSE CommentDetail_cur;
END IF;
END SP_Insert_Comment_Detail;Sorry about that, error came from elsewhere...
Thanks anyway
Best regards
Neil. -
ORA-22275 Invalid lob locator when using CLOB from a view
Hi,
I am having problems when passing a CLOB from a "Union all" view to a function. I get an ORA-22275 error when trying to construct an XmlType from the CLOB and
the CLOB originates from a view. If the CLOB originates from a table, eveyting works fine. Here is the code, that reproduces the problem
CREATE TABLE testclob
(field1 CLOB)
-- insert some data
insert into testclob values ('<a/>');
-- Define a clob view over some tables
create or replace view v_testclob
(field1)
as
select field1 from testclob
union all
select field1 from testclob; -- in reallity I use different tables
-- Creat a functions that proceses the CLOB
CREATE OR REPLACE
function MyFunction(v_myClob clob) return VARCHAR2
IS
myXML XMLTYPE;
BEGIN
select xmltype(v_myClob) into myxml from dual; -- the view crashes ** HERE **
-- code ommited
return 'some data';
END;
-- Try to use the function:
-- Selecting from a table works OK
select myfunction(field1) from testclob;
-- Selecting from the view crashes
select myfunction(field1) from v_testclob;
Error: ORA-22275: invalid LOB locator specified ORA-22275: invalid LOB locator specified ORA-06512: at "D_TEST.MYFUNCTION", line 6
-- I using the following version:
select * from v$version;
-- Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
-- PL/SQL Release 9.2.0.1.0 - Production
-- CORE 9.2.0.1.0 Production
-- TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
-- NLSRTL Version 9.2.0.1.0 - Production The only workaround I have found is to use substr
select xmltype(dbms_lob.substr(v_myClob)) into myxml from dual; -- workaround.. but this mght trucnate my data.
What am I doing wrong?
MatejYou need to apply the latest patchset for your version of the database on your version of the operating system:
SQL> CREATE TABLE testclob
2 (field1 CLOB)
3
SQL> /
Table created.
SQL>
SQL> -- insert some data
SQL> insert into testclob values ('<Data>Testing</Data>')
2 /
1 row created.
SQL>
SQL> -- Define a clob view over some tables
SQL>
SQL> create or replace view v_testclob
2 (field1)
3 as
4 select field1 from testclob
5 union all
6 select field1 from testclob
7 /
View created.
SQL>
SQL> -- Creat a functions that proceses the CLOB
SQL>
SQL> CREATE OR REPLACE
2 function MyFunction(v_myClob clob) return VARCHAR2
3 IS
4 myXML XMLTYPE;
5 BEGIN
6
7 select xmltype(v_myClob) into myxml from dual; -- the view crashes ** HERE **
8 -- code ommited
9 return 'some data';
10 END;
11
12 /
Function created.
SQL> -- Try to use the function:
SQL> -- Selecting from a table works OK
SQL> select myfunction(field1) from testclob;
MYFUNCTION(FIELD1)
some data
SQL>
SQL>
SQL> -- Selecting from the view crashes
SQL> select myfunction(field1) from v_testclob;
MYFUNCTION(FIELD1)
some data
some data
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
SQL> -
DBMS_LOB.ISOPEN throws the error ora-22275 invalid lob locator
DBMS_LOB.ISOPEN throws the error below error.
ora-22275 invalid lob locator
The below assume that i am getting the v_lob_length as empty. But i am getting error when it comes to DBMS_LOB.ISOPEN.
Please correct me if i am wrong.
here is my code:
DBMS_LOB.createtemporary(v_xml_clob, TRUE);
DBMS_LOB.open(v_xml_clob, DBMS_LOB.lob_readwrite);
SELECT DBMS_XMLGEN.getxml ('SELECT object_name, object_type from dba_objects where rownum <= 5')
INTO v_xml_clob
FROM DUAL;
v_lob_length := NVL(DBMS_LOB.getlength(v_xml_clob),0);
v_index := 1;
fnd_file.put_line(fnd_file.log,'v_lob_length : '||v_lob_length);
WHILE v_index <= v_lob_length
LOOP
v_read_cnt := 32767;
DBMS_LOB.read (
v_xml_clob,
v_read_cnt,
v_index,
v_chunk
fnd_file.put(fnd_file.output,v_chunk);
v_index := v_index + v_read_cnt;
END LOOP;
IF DBMS_LOB.ISOPEN(v_xml_clob) = 1
THEN
DBMS_LOB.close(v_xml_clob);
DBMS_LOB.freetemporary(v_xml_clob);
END IF;Most likely v_xml_clob is NULL so you'd rather check IF v_xml_clob IS NOT NULL AND DBMS_LOB.ISOPEN(v_xml_clob) = 1
THENbye
TPD -
Using DBMS_LOB.COPY - (ORA-22275)
Hi All,
I need to copy BLOB value from one table to another.
For that i am using DBMS_LOB.COPY.
I am not sure if this is the right approach. If not, can someone help me out.
Mentioned below is my sample procedure:
CREATE OR REPLACE PROCEDURE INS_UPD_BLOB
i_ID number,
o_OutputStatus OUT NUMBER,
o_OutputMessage OUT VARCHAR2
as
v_blob_data_d blob;
v_blob_data_s blob;
amt INTEGER := 4000;
begin
select BLOB_DATA
into v_blob_data_d
from blob_test_dest -- My Destination Table
where id = i_ID
for update;
select BLOB_DATA
into v_blob_data_s
from blob_test -- My Source Table
where id = i_ID;
DBMS_LOB.COPY(v_blob_data_d, v_blob_data_s, amt);
o_OutputStatus := 0;
o_OutputMessage := 'SUCCESS';
EXCEPTION
WHEN OTHERS THEN
o_OutputStatus := -1;
o_OutputMessage := 'Procedure ins_upd_blob Failed at step no:- '||v_ErrorFlag|| ' SQL ERROR:- '||SUBSTR(SQLERRM,1,100);
END;
After execution i am getting following error:
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
Thanks,
Srikanthhow about using merge instead of dbms_lob package?
CREATE OR REPLACE PROCEDURE INS_UPD_BLOB
i_ID number,
o_OutputStatus OUT NUMBER,
o_OutputMessage OUT VARCHAR2)
as
v_blob_data_d blob;
v_blob_data_s blob;
amt INTEGER := 4000;
begin
merge into blob_test_dest b1
using (select id, blob_data from blob_test) b2
on (b1.id = i_id and b1.id = b2.id)
when not matched then insert(b1.id, b1.blob_data) values(b2.id,b2.blob_data)
when matched then update set b1.blob_data = b2.blob_data;
END;
/ -
Why DBMS_LOB.CONVERTTOBLOB gives me exception?
Hi, guys:
I have a task to implement a download link in apex to download RTF file. I have finished the APEX part, however, I got the problem in the PL/SQl part. Here is my code:
procedure downloadTest is
strLetter clob;
strLetter_len number;
v_mime varchar2(48) := 'application/msword';
v_blob BLOB;
v_blob_offset integer;
v_clob_offset integer;
v_blob_csid integer:=DBMS_LOB.DEFAULT_CSID;
v_lang_context integer:=DBMS_LOB.DEFAULT_LANG_CTX;
v_warning integer;
l_server sor_email_config.server%type;
l_sender sor_email_config.sender%type;
error_message varchar2(500);
begin
strLetter:='Test if this file downloadable!';
--strLetter_len:=DBMS_LOB.GETLENGTH(strLetter);
strLetter_len:=DBMS_LOB.LOBMAXSIZE;
v_blob_offset:=1;
v_clob_offset:=1;
v_blob:=null;
DBMS_LOB.CONVERTTOBLOB(v_blob, strLetter, strLetter_len, v_blob_offset, v_clob_offset, v_blob_csid, v_lang_context, v_warning);
OWA_UTIL.mime_header (NVL (v_mime, 'application/pdf'), FALSE);
HTP.p ('Content-length: ' || strLetter_len);
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (v_blob);
exception
WHEN OTHERS THEN
error_message:=substr(SQLERRM, 1, 400);
raise_application_error(SOR_ERROR_CONSTANTS_PKG.errnum_GENERAL, 'SOR_COMPLIANCE_ADMIN.downloadTest when generating document '||SOR_ERROR_CONSTANTS_PKG.errmsg_GENERAL||error_message);
end downloadTest;however, I got exception as follows:
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275 for Execute PL/SQL Code.
I know the problem occurs during DBMS_LOB.CONVERTTOBLOB. Could anyone give me a hint about this problem?
Thanks a lot!
Sam
Edited by: lxiscas on May 15, 2013 10:09 AMThank you for all help you guys provided! I finally made it. It looks APEX 4.1/11GR2 conflicts with wpg_docload.download_file, I have to raise APEX internal exception by calling apex_application.stop_apex_engine, and call the download process in a application process. check Blob download via wpg_docload is not working
for anyone's convenience:
procedure downloadTest is
strLetter clob;
strLetter_len number;
v_mime varchar2(48) := 'application/msword';
--v_mime varchar2(48);
v_blob BLOB;
v_file_name varchar2(100);
v_length number;
v_blob_offset integer;
v_clob_offset integer;
v_blob_csid integer:=DBMS_LOB.DEFAULT_CSID;
v_lang_context integer:=DBMS_LOB.DEFAULT_LANG_CTX;
v_warning integer;
l_server sor_email_config.server%type;
l_sender sor_email_config.sender%type;
error_message varchar2(500);
begin
strLetter:='Test if this file downloadable!';
--strLetter_len:=DBMS_LOB.GETLENGTH(strLetter);
strLetter_len:=DBMS_LOB.LOBMAXSIZE;
v_blob_offset:=1;
v_clob_offset:=1;
DBMS_LOB.CREATETEMPORARY(v_blob, true);
DBMS_LOB.CONVERTTOBLOB(v_blob, strLetter, strLetter_len, v_blob_offset, v_clob_offset, v_blob_csid, v_lang_context, v_warning);
OWA_UTIL.mime_header (NVL (v_mime, 'application/pdf'), FALSE);
HTP.p ('Content-length: ' || strLetter_len);
htp.p( 'Content-Disposition: filename="test"' );
OWA_UTIL.http_header_close;
-- download the BLOB
wpg_docload.download_file( v_blob );
apex_application.stop_apex_engine;
exception
WHEN OTHERS THEN
/*error_message:=substr(SQLERRM, 1, 400);
raise_application_error(SOR_ERROR_CONSTANTS_PKG.errnum_GENERAL, 'SOR_COMPLIANCE_ADMIN.downloadTest when generating document '||SOR_ERROR_CONSTANTS_PKG.errmsg_GENERAL||error_message);*/
HTP.htmlopen;
HTP.headopen;
HTP.title('File Downloaded');
HTP.headclose;
HTP.bodyopen;
HTP.header(1, 'Download Status');
HTP.print(SQLERRM);
HTP.bodyclose;
HTP.htmlclose;
end downloadTest;Thank you again for your help!
Sam
Edited by: lxiscas on May 17, 2013 6:52 AM -
ORA-22275 error when running a USER_DATASTORE index on CLOB column
Running Oracle 9.2.0.8
Getting the following errors thrown for every row in the table when creating the index:
DRG-12604: execution of user datastore procedure has failed
DRG-50857: oracle error in drsinopen
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 347
ORA-06512: at "CRT_DEV.MULTI_INDEX_EN_PRC", line 27
ORA-06512: at "CTXSYS.CTXSYS_MULTI_INDEX_EN_PRC", line 7
ORA-06512:
Index scripts:
ctx_ddl.create_preference( 'crt_user_datastore_en', 'user_datastore' );
ctx_ddl.set_attribute( 'crt_user_datastore_en', 'procedure', 'ctxsys_multi_index_en_prc' );
ctx_ddl.set_attribute('crt_user_datastore_en', 'output_type', 'CLOB');
CTX_DDL.create_preference('CRT_PREF_EN','BASIC_WORDLIST');
ctx_ddl.set_attribute('CRT_PREF_EN','FUZZY_MATCH','ENGLISH');
ctx_ddl.set_attribute('CRT_PREF_EN','STEMMER','ENGLISH');
ctx_ddl.set_attribute('CRT_PREF_EN','SUBSTRING_INDEX','TRUE');
CTX_DDL.create_section_group('CRT_HTML_SECTION','HTML_SECTION_GROUP');
CTX_DDL.add_zone_section('CRT_HTML_SECTION', 'title', 'TITLE');
ctx_ddl.create_preference('CRT_LEXER_EN', 'BASIC_LEXER');
ctx_ddl.set_attribute('CRT_LEXER_EN', 'skipjoins', '-');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'index_text', 'YES');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'base_letter', 'YES');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'index_stems', 'ENGLISH');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'index_themes', 'YES');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'theme_language', 'ENGLISH');
CREATE INDEX MULTI_CONTENT_EN_IDX ON CONTENTS
(top_content_html_en)
INDEXTYPE IS CTXSYS.CONTEXT
parameters ('filter ctxsys.null_filter DATASTORE crt_user_datastore_en LEXER CRT_LEXER_EN wordlist CRT_PREF_EN section group CRT_HTML_SECTION');I have issued the following grants:
grant execute on CTXSYS.ctxsys_multi_index_fr_prc to CRT;
grant execute on CTXSYS.ctxsys_multi_index_en_prc to CRT;
grant execute on CRT_DEV.multi_index_fr_prc to CTXSYS;
grant execute on CRT_DEV.multi_index_en_prc to CTXSYS;CRT is the index owner schema
CRT_DEV is the schema owning the user_datastore procedure. (Could this be the problem?) Should the procedure reside in the same schema as index owner?
Here are my procedures:
CTXSYS stub:
CREATE OR REPLACE PROCEDURE ctxsys_multi_index_en_prc (
rid IN ROWID,
tlob IN OUT CLOB
IS
BEGIN
crt_dev.multi_index_en_prc (rid, tlob);
END;Actual procedure:
CREATE OR REPLACE PROCEDURE multi_index_en_prc (rid IN ROWID, tlob IN OUT CLOB)
IS
BEGIN
FOR c1 IN (SELECT '<TITLE>'
|| cc.content_category_name_en
|| '</TITLE>' content_title,
c.content_html_content_en, c.top_html_content_en
FROM content_categories cc, CONTENTS c
WHERE cc.content_category_id = c.content_category_id
AND c.ROWID = rid)
LOOP
DBMS_LOB.writeappend (tlob, LENGTH (c1.content_title),
c1.content_title);
DBMS_LOB.append (dest_lob => tlob, src_lob => c1.top_html_content_en);
DBMS_LOB.append (dest_lob => tlob,
src_lob => c1.content_html_content_en
END LOOP;
END multi_index_en_prc;I can run the following test script, and get no errors:
declare
rid rowid;
tlob clob;
begin
dbms_lob.CREATETEMPORARY(tlob,false);
CRT_DEV.multi_index_en_prc('AAAC0UAAMAAAAMAAA2',tlob);
dbms_output.put_line(dbms_lob.GETLENGTH(tlob));
dbms_output.put_line(dbms_lob.substr(tlob,25));
dbms_lob.FREETEMPORARY(tlob);
end;Output:
25
<TITLE>References</TITLE>
I'm at a total loss on the cause of the error.
Any help/tips is appreciated!
Thanks
Edited by: pl_sequel on Feb 9, 2010 11:25 AMThanks Roger.
I did add those in... DBA insists that didn't matter, since explicit "select" privs were granted to CRT_DEV to select CRT tables. He did say that a length check was required on the CLOBS before appedning them to the destination lob (tlob) to prevent NULL lob locators being appended and raising the exception.
In any case, it works now... however, unsure if it's due to the schema prefix on the tables, or the lob length checks... -
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.Yes, I suspect it is the Java that is causing the problem. The code is below. I can't see that there is anything unusual here so why should there be a locater problem?
import java.io.IOException;
import java.io.Writer;
import java.sql.*;
import oracle.sql.CLOB;
public class TheJava {
public static CLOB getData(int arg) throws SQLException{
Connection conx = null;
String message = new String();
CLOB tempClob = null;
Writer tempClobWriter = null;
try{
conx = DriverManager.getConnection("jdbc:default:connection:");
tempClob = oracle.sql.CLOB.createTemporary(conx, true, oracle.sql.CLOB.DURATION_SESSION);
tempClob.open(oracle.sql.CLOB.MODE_READWRITE);
tempClobWriter = tempClob.getCharacterOutputStream();
}catch(SQLException sqlexp){
message = "! CLOB problem.\n ";
message += sqlexp.getMessage();
if(tempClob!=null){
//line A is next line
tempClob.putString(1,message);
return tempClob;
}//end if tempclob
}catch(Exception exp){
message = "! Some other exception.\n ";
message += exp.getMessage();
if(tempClob!=null){
tempClob.putString(1,message);
return tempClob;
}//end if tempclob
}finally{
if(tempClob!=null){ tempClob.freeTemporary(); }
if(conx != null){ conx.close(); }
}//end try catch
In an earlier test I was getting an error reported at line A (I had tried to start from position 0).
Maybe you are looking for
-
When I turn on my Macbook, only a blue screen appears with no Dock or info in the menu bar
When I went to turn on my Macbook OS X today, only a blue background showed up. For some reason the only program that opened was Bittorrent and besides that in the menu bar at the top there is nothing on the screen. The dock wont appear even if I hol
-
I was able to sync my iPad with outlook. The sync no longer works
Did IOS 5 change the way iPads sync with outlook? I don't get The "sync" message bar on the iPad either. Any ideas?
-
How to get String out of void method
I have a problem to get String out of void method. I override method actionPerformed(), and I need to use String from this method in other methods. I get nothing in smth. Can anyone help me with this. class StringBuffer smth = new StringBuffer(); Str
-
I cannot lookup connection factory
Hello! I try to run JMS with J2EE SDK. I started j2ee -verbose and I have written code as follows but I always get "javax.naming.CommunicationException: Can't find SerialContextProvider": Hashtable properties = new Hashtable(); properties.put(Context
-
Can i use cl_gui_alv_tree_simple Manually add node(row)?
hi, experts. I use create object type ref to cl_gui__alv_tree_simple. after display ,can i add row or node by hands. if can ,which method? thanks~~~