Dbms_lob package
i am using this method dbms_lob.getlength(column name) from table name;
as far as i know this column can be a clob column or blob column or bfile column
i have a row in these columns inserted via java at the sql prompt i just want to see the length of the row of each of these cols
when i say
dbms_lob.getlength(column name) from table name in case of a bfile or a clob column it works perfectly and shows me the length for the row
but with blob i get the following error
non existing directory or file for getlength
null
No insert. You have to insert it by writing the part before then insert, writing the new portion, and then write the part after then place you inserted.
Similar Messages
-
DBMS_LOB Package for CLOB Issues
I was wondering if any of you have worked with DBMS_LOB
packages. I wrote a procedure that will be invoked from a 'C'
program. I was first compiling the procedure as follows:
procedure <procedurename> (c_text out char, length in number)
declare c_lob CLOB;
begin
SELECT lob_locator_column into c_lob from <table>
WHERE
<table>.id = '1';
dbms_lob.read(c_lob,length,1,c_text)
end;
When I compile this program I am getting an error "length cannot
be used as a target". Have any of you seen this problem?
Right now I am getting around by declaring another variable and
assigning the input length to the variable and passing it into
DBMS_LOB.
Another issue I have is that the DBMS package is returning the
length of the clob to be an "INTEGER". What happens if the clob
length is greater than 32767?
nullI guess you are using a reserved word..
Bala Vanukuru (guest) wrote:
: I was wondering if any of you have worked with DBMS_LOB
: packages. I wrote a procedure that will be invoked from a 'C'
: program. I was first compiling the procedure as follows:
: procedure <procedurename> (c_text out char, length in number)
: declare c_lob CLOB;
: begin
: SELECT lob_locator_column into c_lob from <table>
: WHERE
: <table>.id = '1';
: dbms_lob.read(c_lob,length,1,c_text)
: end;
: When I compile this program I am getting an error "length
cannot
: be used as a target". Have any of you seen this problem?
: Right now I am getting around by declaring another variable
and
: assigning the input length to the variable and passing it into
: DBMS_LOB.
: Another issue I have is that the DBMS package is returning the
: length of the clob to be an "INTEGER". What happens if the
clob
: length is greater than 32767?
null -
How to import DBMS_LOB package in java
hi
how we can use pl/sql's package in java
any body can help me
where i can found harachy of DBMS_LOB package
to include in my java or jsp program
thanxperhaps this topic can help :
Calling PL/SQL from Java
and the use of DBMS_LOB package is here:
Supplied PL/SQL Packages and Types Reference Contents / Search / Index / PDF
http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96612.pdf
Java Stored Procedures Developer's Guide Contents / Search / Index / PDF
http://otn.oracle.com/pls/db92/db92.docindex?remark=homepage
I hope that can help you. Perhaps another person can give the excat code.
Good luck!
Joel P�rez -
Oracle Reports : Run time error when there is a call to DBMS_LOB package
I am facing a strange issue, please do share if you have some inputs. When I try running the compiled RDF report(Generating XML to be specific), Oracle Reports Builder crashes when I make use of the following formula function. Strangely, this works fine in the backend. Moreover I tried debugging and by trial and error method found out that, when there is a call to the DMBS_LOB package it errors (works fine when this is commented). Please do let me know whats the root cause of this issue. Thanks in advance
function CF_ClientSignatureFormula return VARCHAR2 is
file_name BFILE;
dir_name VARCHAR2(100);
dest_file_name VARCHAR2(100);
dest_path VARCHAR2(400);
begin
SELECT client_signature
INTO file_name
FROM xxfpr.fpr_rcp_bank_details frb,
Xxfpr. fpr_rcp_gtn_rpt_map frm
WHERE frb.record_id = frm.bank_record_id
AND frm.gtn_request_id = :p_gtn_request_id;
SYS.DBMS_LOB.filegetname(file_name,dir_name,dest_file_name);
SELECT directory_path INTO dest_path FROM all_directories where directory_name = dir_name;
dest_path := dest_path || '/' || dest_file_name;
return dest_path;
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
end;
Thanks,
NirmalGeoAnd what version of Reports are you using?
BFILES are accessible from the database, not the client (Reports). So, put your code in the database. -
How to Set my own Character Set in DBMS_LOB Package
Hello All
A Very Good Morning.
I am using DBMS_LOB.CONVERTTOCLOB To convert data in BLOB to CLOB.
My Database Character set is AL32UTF8.
I want to change that one to WE8ISO8859P15.
In DBMS_LOB.CONVERTTOCLOB package there is a parameter BLOB_CSID.
In the Documentation it is said that I can set this value to a desired Character set.
But the value should be of Integer Type.
How to set the Character Set conversion.
Regards
Madhu KTo get the id you looking for run:
select * from V$NLS_VALID_VALUES where parameter='CHARACTERSET';make sure your characterset is in there and then run:
select NLS_CHARSET_ID('WE8ISO8859P15') from dual;This is the id or number you want to pass into the DBMS_LOB.CONVERTTOCLOB. -
Quetion related to dbms_lob package
i have created the following procedure:
create or replace procedure temp_clob as
num clob;
amount number;
offset number;
output varchar2(10);
begin
amount:=10;
offset:=1;
select data1 into num from test_clob where id1=1;
dbms_lob.read(num,amount,offset, output);
dbms_output.put_line('DATA: '||output);
end;
and Procedure was created .
But on executing this procedure i got these errors
BEGIN temp_clob; END;
ERROR at line 1:
ORA-06509: PL/SQL: ICD vector missing for this package
ORA-06512: at "LOBIS.DBMS_LOB", line 648
ORA-06512: at "LOBIS.TEMP_CLOB", line 10
ORA-06512: at line 1
please tell me the solution !!!Hi Yogesh,
Please post your question in
PL/SQL
for a quick response.
Regards,
Anupama -
Error in using DBMS_LOB Package
Hi,
I am attaching a PDF File through a database procedure as shown below
create or replace procedure load_document(document_id in number, filename IN varchar2, doc_desc IN VARCHAR2, doc_type IN VARCHAR2) as
f_lob bfile;
b_lob blob;
--document_name varchar2(30);
--mime_type varchar2(30);
document_name oea_documents.document_name%TYPE;
mime_type oea_documents.document_mime_type%TYPE;
dot_pos number;
v_file_type VARCHAR2(10);
begin
-- Find the position of the dot ('.') located in the filename
dot_pos := instr(filename,'.');
-- Get the filename without extension and use it as image name
document_name := substr(filename,1,dot_pos-1);
-- Build the mime type . Retrieve the file extension and add it to 'image/'
v_file_type := SUBSTR( filename, dot_pos+1, Length(Filename) );
IF ( UPPER(v_file_type) IN ('JPG','JPEG','TIF','TIFF','GIF') ) THEN
mime_type := 'image/'||substr( filename , dot_pos+1 , length(filename) );
ELSIF ( UPPER(v_file_type) = 'PDF' ) THEN
mime_type := 'application/pdf';
ELSIF ( UPPER(v_file_type) = 'DOC' )THEN
mime_type := 'application/msword';
ELSIF ( UPPER( v_file_type) = 'XLS') THEN
mime_type := 'application/ms-excel';
ELSE
mime_type := 'image/'||substr( filename , dot_pos+1 , length(filename) );
END IF;
insert into oea_documents (document_id,
document_name,
document_mime_type,
document,
document_description,
document_type
values(document_id, document_name, mime_type, empty_blob(),doc_desc,doc_type) return document into b_lob;
-- /!\ Directory name has to be UpperCase !
f_lob := bfilename('FILE_LOAD',filename);
o_dset_test('5');
dbms_lob.fileopen(f_lob,dbms_lob.file_readonly);
o_dset_test('6');
dbms_lob.loadfromfile(b_lob,f_lob,dbms_lob.getlength(f_lob) );
dbms_lob.fileclose(f_lob);
commit;
end;
FILE_LOAD is a folder on the database server(unix).
I have also tried to give the full path on the unix databse server instead of FILE_LOAD directory but then it gives error ora-22285.
while executing this procedure I am getting the error ora-22288(Invalid file or directory).
But this occurs randomly
For instance i tried to attach a pdf file with the name cross.pdf ,it gave me the above error and when i renamed the file as Cross.pdf it attached successfully.
The error comes whilke executing the statement dbms_lob.fileopen(f_lob,dbms_lob.file_readonly);
Please guide on the above issue.Hi,
Welcome to the forum!
user1356624 wrote:
f_lob := bfilename('FILE_LOAD',filename);
FILE_LOAD is a folder on the database server(unix).
I have also tried to give the full path on the unix databse server instead of FILE_LOAD directory but then it gives error ora-22285.The first argument to BFILENAME is the name of a directory object, as found in the directory_name column of all_directories. That is not the same thing as a folder name, which is found in the directory_path column of all_directories. Look up [CREATE DIRECTORY|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_5007.htm#sthref6211] in the SQL Language manual for a description of Oracle's directory objects.
If you have problems with this, post the results of
SELECT *
FROM all_directories;It might also be useful to see the Oracle "CREATE DIRECTORY" command that was used.
As you probably noticed, this site compresses white space by default.
When you post code or results on this site, type these 6 characters:
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
Edited by: Frank Kulash on Aug 10, 2009 3:35 PM
Added link. -
Error while creating AW using DBMS_LOB with XML..
Hi All,
I am trying to create AW using DBMS_LOB package with XML,
while creating AW,i am facing the following error.find the code also below :
declare
xml_awcreate_clob clob;
xml_awcreate_st varchar2(4000);
begin
DBMS_LOB.CREATETEMPORARY(xml_awcreate_clob,TRUE);
dbms_lob.open(xml_awcreate_clob, DBMS_LOB.LOB_READWRITE);
dbms_lob.writeappend(xml_awcreate_clob, 48, '<?xml version = ''1.0'' encoding = ''UTF-8'' ?>');
dbms_lob.writeappend(xml_awcreate_clob, 43, '');
dbms_lob.writeappend(xml_awcreate_clob, 63, '<AWXML version = ''1.0'' timestamp = ''Mon Feb 11 13:29:11 2002'' >');
dbms_lob.writeappend(xml_awcreate_clob, 15, '<AWXML.content>');
dbms_lob.writeappend(xml_awcreate_clob, 25, ' <Create Id="Action41">');
dbms_lob.writeappend(xml_awcreate_clob, 19, ' <ActiveObject >');
dbms_lob.writeappend(xml_awcreate_clob, 163, ' <AW Name="NEW_XML_AW" LongName="NEW_XML_AW" ShortName="NEW_XML_AW" PluralName="NEW_XML_AW" Id="NEW_XML.AW"/>');
dbms_lob.writeappend(xml_awcreate_clob, 19, ' </ActiveObject>');
dbms_lob.writeappend(xml_awcreate_clob, 11, ' </Create>');
dbms_lob.writeappend(xml_awcreate_clob, 16, '</AWXML.content>');
dbms_lob.writeappend(xml_awcreate_clob, 8, '</AWXML>');
dbms_lob.close(xml_awcreate_clob);
xml_awcreate_st := sys.interactionExecute(xml_awcreate_clob);
end;
ORA-21560: argument 2 is null, invalid, or out of range
ORA-06512: at "SYS.DBMS_LOB", line 833
ORA-06512: at line 12
Any idea or thought on this would be appreciable.
Thanks in advance.
AnwarDid you change any of the text in the lob write statements ?
I believe you get this error if you increase the number of characters without increasing the 1st argument which looks as though it represents the number of characters -
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;
/ -
DBMS_LOB.FILEOPEN(dir, fname) gives non-existent dir or file error
Hello!
I've been trying to load an image file into the oracle database using the DBMS_LOB loadfromfile procedure. In order to do this, I first have to open the appropriate file which I do using
temp_bfile := bfilename('temp_dir', in_filename);
where in_filename is a string having the appropriate filename. and 'temp_dir' is a directory object created as follows:
CREATE DIRECTORY temp_dir AS 'F:\';
Next when I do a
DBMS_LOB.FILEOPEN(temp_bfile, LOB_READONLY);
I get an exception ORA-22285:non-existent directory or file.
What am I doing wrong? Is the way I've created the directory object correct. I work on an NT machine.
MonaNot sure if the UTL_FILE package is the same but if you don't set the "utl_file_dir" variable in the INIT.ORA file prior to calling the FOPEN procedure you will get a similiar error. There may be an equivalent parameter for the DBMS_LOB package.
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Mona Marathe ([email protected]):
Hello!
I've been trying to load an image file into the oracle database using the DBMS_LOB loadfromfile procedure. In order to do this, I first have to open the appropriate file which I do using
temp_bfile := bfilename('temp_dir', in_filename);
where in_filename is a string having the appropriate filename. and 'temp_dir' is a directory object created as follows:
CREATE DIRECTORY temp_dir AS 'F:\';
Next when I do a
DBMS_LOB.FILEOPEN(temp_bfile, LOB_READONLY);
I get an exception ORA-22285:non-existent directory or file.
What am I doing wrong? Is the way I've created the directory object correct. I work on an NT machine.
Mona<HR></BLOCKQUOTE>
null -
DBMS_LOB retrieve jpg files from Blobs
Help me, please
I have some application on ORA9.2.01 , and I'm using a DBMS_LOB package for storing jpg filon WIN200 Adv.Server as BLOBS. When I tried to retrieve those files using UTL_ .. package , as is in literature recommended , I obtained in every case non identical , or damaged greater files than originals.
Help me , please with this my problem.
Thousand thanks. Jarda.
When You are so kind to help me , send please Yor response to [email protected]Help me, please
I have some application on ORA9.2.01 , and I'm using a DBMS_LOB package for storing jpg filon WIN200 Adv.Server as BLOBS. When I tried to retrieve those files using UTL_ .. package , as is in literature recommended , I obtained in every case non identical , or damaged greater files than originals.
Help me , please with this my problem.
Thousand thanks. Jarda.
When You are so kind to help me , send please Yor response to [email protected] -
Hi,
With regards to format the SQL trace files, could DBMS_LOB package helps us in order to format the SQL trace files instead of using TKPROF utility.
If so, could some one suggest how we use dbms_lob package in order to format the sql trace files.
Thanks
Kumarhi,
Should we read the SQL TRACE files USING DBMS_LOB?
I know in UTL_RAW package ,we can use utl_raw.cast_to_varchar2 to take a raw input and changes the data type from raw to varchar2.
But I don't have a sample code io order to test this.
Is that possible that via above point, we can read the sql trace files with out using TKPROF.
COuld some one have a little sample of it.
Thanks
Kumar -
Hi, I use DBMS_LOB package to save large text data in the database. The problem is whenever I deploy the form to a different version of database, I have to recompile the form. is there any way to construct a clob object in forms and save it to database without using DBMS_LOB package?
Thank You,I don't know your code nor do I know why you need to recompile your form (I guess it's the infamous signature of package xyz has been changed ); however did you try to wrap your logic in a stored procedure and call this procedure in your form?
It might be religion, but personally I avoid calling sys objects directly in forms but rather call them in my own stored procedures / views / whatsoever and use my stored procedures in forms. This has also the benefit that you just need to grant the sys objects to your schema owner and to nobody else. Giving as few grants as possible to the end users is also very desireable. Do I want my end users to be able to do some stuff which maybe requires privilages like alter system ? Maybe. Do I want my end users to be able to issue alter system ? Not a chance. So I wrap the needed alter system commands in a database package, grant my schema owner alter system (nobody will know his password) and grant the package to the end users. By that they are able to change the system the way it is needed, but nothing else.
cheers -
Hi! I'm trying to install an image cartridge to our database running in Oracle 8.0.5 for Sun SPARC Solaris. My problem is I can't successfully create the image cartride because i can't compile the ORDIMG_PKG. When I looked at the package body of the ORDIMG_PKG in the schema manager, most of the errors in compilation referred to the DBMS_LOB package (ex. "identifier 'DBMS_LOB.GETLENGTH' must be declared"). I tried to look for the DBMS_LOB package under the SYS user and can NOT find it! Where can I find the DBMS_LOB package? Am I supposed to install it separately or was it supposed to be installed along with all the PL/SQL packages?
Please help!
GDBMS_LOB is installed as part of database installation. Please double check your database installation log for any possible database creating errors.
Thanks. -
I have a clob database field and I want to replace every occurence of a char with another one(for ex. all 'a's to 'b's). There is not a repalce function in dbms_lob package and I want to know if there is a practical way of doing this.
Thanks a lot.It's not ideal but as you're looking for chunks of text this is probably the only way.
(1) Create a temporary LOB.
(2) Use DBMS_LOB.INSTR() to find "dangeous HTML", however you define that.
(3) Use DBMS_LOB.SUBSTR() and DBMS_LOB.WRITEAPPEND() to copy the safe HTML to the temporary lob.
(4) Overwrite the CLOB with the temporary LOB.
There may be smarter ways of doing this in 10g with regular expressions, but without knowing more about your scenario I wouldn't like to comment further.
Cheers, APC
Maybe you are looking for
-
Cannot Open Aperture after upgrading to 3.4.5 from 3.4.4
Error message: the installed graphics card does not meet minimum requirements for Aperture. If I go back to 3.4.4 aperture works.
-
Dear Experts, We are using Ecc 6.0 here we found some problem during PO and MIRO T Code In ME21N we face tax code is blank in some cases and po is saved we can take GR and MIRO successfully how is it possible i can't understand. During MIRO one can c
-
How to set a context of "/" ??
How can i set a context of either "" or "/" such that when i call the URL htpp://localhost:7001/ I go to the location specified for that context ? Is this possible ? Srini
-
Problem in extracting data from source system
HI I am comparing source system and data in bW for a particular datasource.In this process in source system transaction RSA3 when i am trying to extract data its not showing the exact count.I couldnt able to understand the setting options like Dat
-
Feature Request: Scan attached drives to automatically find and reconnect "missing" images
This is the kind of thing that computers are good for. I'm surprised that we've made it all the way to version 5 without this feature being added. It would be relatively easy. Scan the catalog to make an internal list of all images that are "missing