INSERTING BLOB/CLOB DATATYPES
How to insert and retreive image(gif) files in BLOB field of a Table.
Please mention the SQL statements for doing the same.
While creating the table I have used EMPTY_BLOB() to create an empty locator for the BLOB field.
I tried to insert the image file thru DBMS_LOB package's WRITE function, but it gave an error.
DECLARE
v_blob_var BLOB;
v_no_of_bytes NUMBER := 10240;
write_offset NUMBER := 0;
gif_file VARCHAR2(40) := 'F:/TMP/ABC.GIF'; /* Size of ABC.GIF is 9Kb. */
BEGIN
SELECT blob_fld INTO v_blob_var FROM table_name
WHERE pk = 1;
dbms_lob.write(v_blob_var, v_no_of_bytes, write_offset, gif_file);
END;
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
ORA-06512: at line 9
null
My question is where we have to install the drivers or jar files.JDBC Driver or the jar files are installed by default when you install Oracle.
Check in ORACLE_HOME/jdbc/lib. You will find classes12.jar or classes12.zip or ojdbc14.jar. They are there for JDBC connections.
for default installation only -
In 10g if oracle client is installed on c: drive -
the path is C:\Oracle\product\10.1.0\Client_1\jdbc\lib
or if server then just change the client_1 to db_1
Regards,
Sanjeev.
Similar Messages
-
Hi,
I searched and found how to insert into clob datatype
SQL> create table employee(ename char(11),id number,info clob);
Table created.
SQL> insert into employee values('anil',100,empty_clob());
1 row created.
SQL> update employee set info='jkkkkkkkkkksdflfweuikddddddddddddddddddddddddddddaaaaaaaaaaaaaaaaaaaa';
1 row updated.
SQL> select * from employee;
ENAME ID
INFO
anil 100
jkkkkkkkkkksdflfweuikdddddddddddddaaaaaaaaaaaaaaaaaaaaaaaaaaaNow if i want to insert another row into this table having clob datatype,
Then how to insert into itWhat's the problem exactly?
SQL> create table employee (ename char(11), id number, info clob);
Table created.
SQL> insert into employee values ('anil',100,'here is some info');
1 row created.
SQL> insert into employee values ('fred',200,'here is freds info');
1 row created.
SQL> select * from employee;
ENAME ID INFO
anil 100 here is some info
fred 200 here is freds info
SQL> -
Create clob datatype in a column
Hi,
I am working in oracle9i and solaris 5.8.
I want to create a table with a cloumn contains clob Datatype..
Please explain me how to create a clob datatype in a column and how to assign this and how to insert datas into the datatype...
Regs..Hey,
Read this below link. It will useful for inserting a clob datatype column,
Re: CLOB
Regards,
Moorthy.GS -
Extracting clob/blob/long datatypes in delimited file
I have a few tables in database that have clob/blob/long datatypes. I need to unload this data into delimited file and reload the data into another database. I don't want to use export/import.
Currently the code that i have can handle varchar2, number, date datatypes quite easily using sqlloader.
The tables are not too big (hundred to 10k rows approximately) and performance is important but not crucial. The script can run for a few minutes unloading data, that is fine. Code maintenance is of higher priority with pl/sql being the preferred scripting language.
From the sqlloader manual, i glean that use of special delimiter is important, something like <startlob> and <endlob> .
I need ideas on how to do this.Hi Buddy.
I am having same kind of Problem. I am using very similar procedure Instead of PUT_RAW I am using put line.
Writing is not a problem after writing the image into a file I cannot open that. That means Image got corrupted. If you find out some solutions for your problem please help me
My email id is [email protected]
Thanks
AJI -
Conversion of BLOB datatype to CLOB datatype
Hi,
I would need to convert the column datatype from BLOB to CLOB. currently in the table, the BLOB column has the data. the requirement is to convert this column from BLOB to CLOB datatype.
please help me how to convert from BLOB datatype to CLOB datatype
Thanks
Hari.I have just been dealing with the same issue -- mass conversion of data in BLOB form to CLOB. I think I've finally got it working well. I have a table that has an key column then both a BLOB and a CLOB column. I load the BLOBS into the table then run the following PLSQL block (uses the given proc) to transfer the data from the BLOB column to the CLOB column.
-- Proc to convert BLOB to CLOB
create or replace function stg.blob_to_clob( p_blb in blob ) return clob is
v_clb clob ;
v_dst integer := 1 ;
v_src integer := 1 ;
v_wrn integer ;
v_lng integer := dbms_lob.default_lang_ctx ;
begin
dbms_lob.createtemporary ( v_clb, false ) ;
dbms_lob.converttoclob
( dest_lob => v_clb
, src_blob => p_blb
, amount => dbms_lob.lobmaxsize
, dest_offset => v_dst
, src_offset => v_src
, blob_csid => dbms_lob.default_csid
, lang_context => v_lng
, warning => v_wrn
if ( dbms_lob.NO_WARNING != v_wrn ) then
v_clb := '~~~{ Error: Invalid Character in source BLOB }~~~' ;
end if ;
return v_clb ;
exception
when others then
v_clb := '~~~{ Error: BLOB Conversion Function Failed }~~~' ;
return v_clb ;
end ;
-- Use the proc above to convert each BLOB to a CLOB in the given table.
declare
cursor c1 is
/* Select the BLOBS to be converted. */
select id, m_blob, m_clob
from stg.temp_cnvrt
/* Trying to convert NULL BLOBS will result in an error */
where dbms_lob.getlength(m_blob) > 0
for update ;
v_tmp_clob clob ;
begin
FOR nxt in c1 LOOP
v_tmp_clob := stg.blob_to_clob( nxt.m_blob ) ;
update stg.temp_cnvrt
set m_clob = v_tmp_clob
where current of c1 ;
END LOOP ;
commit ;
end ; -
i have a CLOB datatype column how i will insert record inthis column like picture etc.
For pictures you may need the BLOB datatype. As for examples, why not look up the user guide, it comes with a search function, you know. Here's a link for an CLOB example:
http://download-uk.oracle.com/docs/cd/B19306_01/text.102/b14218/cdatadic.htm#sthref319
C. -
how can i do this?
Hi,
You can check the 'LOB Datatype' sample present at the following location.
http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.htm
You can check the source file of the sample
http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/LOBSample/LOBSample.java.html
It has a method called 'loadSample' which helps to insert data into BLOB(as well as CLOB) datatype.
Regards,
Anupama -
Setting of CLOB Datatype storage space
Hello All!
I unble to insert more then 4000 characters in clob datatype field
how I increate the storage size of the clob field
I'm working in VB 6.0 and oracle 9iOracle will allocate CLOB segments using some default storage options linked to column, table and tablespace.
Example with Oracle 11.2 XE:
SQL> select * from v$version;
BANNER
Oracle Database 11g Express Edition Release 11.2.0.2.0 - Beta
PL/SQL Release 11.2.0.2.0 - Beta
CORE 11.2.0.2.0 Production
TNS for 32-bit Windows: Version 11.2.0.2.0 - Beta
NLSRTL Version 11.2.0.2.0 - Production
SQL> create user test identified by test;
User created.
SQL> grant create session, create table to test;
Grant succeeded.
SQL> alter user test quota unlimited on users;
User altered.
SQL> alter user test default tablespace users;
User altered.
SQL> connect test/test;
Connected.
SQL> create table tl(x clob);
Table created.
SQL> column segment_name format a30
SQL> select segment_name, bytes/(1024*1024) as mb
2 from user_segments;
SEGMENT_NAME MB
TL ,0625
SYS_IL0000020403C00001$$ ,0625
SYS_LOB0000020403C00001$$ ,0625
SQL> insert into tl values('01234456789');
1 row created.
SQL> commit;
Commit complete.
SQL> select segment_name, bytes/(1024*1024) as mb
2 from user_segments;
SEGMENT_NAME MB
TL ,0625
SYS_IL0000020403C00001$$ ,0625
SYS_LOB0000020403C00001$$ ,0625
SQL>Same example run with Oracle XE 10.2 :Re: CLOB Datatype [About Space allocation]
Edited by: P. Forstmann on 24 juin 2011 09:24 -
Problem on CLOB datatype after import
I got problem and call to Oracle support and they use DUL for extract data from datafile to dump file and I import everything is done and no error but when I check in CLOB datatype that have space(blank character) separate each character see below
Original
Oracle
After Import
O R A C L E
So the application cannot execute those data.
Anyone have solution how to fix this problem?
Thanks,
Taohikoif you use a direct insert you are restricted to 4000 characters.
You can put your value in a varchar2 variable and that allows you to insert up to 32767 characters.
declare
my_clob_variable := rpad('x','X',25000);
begin
insert into my_table(my_clob_column)
values(my_clob_variable);
end; -
LogMiner puzzle - CLOB datatype
Hello, everybody!
Sorry for the cross-post here and in "Database\SQL and PL/SQL" forum, but the problem I am trying to dig is somewhere between those two areas.
I need a bit of an advice whether the following behavior is wrong an requires SR to be initiated – or I am just missing something.
Setting:
- Oracle 11.2.0.3 Enterprise Edition 64-bit on Win 2008.
- Database is running in ARCHIVELOG mode with supplemental logging enabled
- DB_SECUREFILE=PERMITTED (so, by default LOBs will be created as BasicFiles - but I didn't notice any behavior difference comparing to SecureFile implementation)
Test #1. Initial discovery of a problem
1. Setup:
<li> I created a table MISHA_TEST that contains CLOB column
create table misha_test (a number primary key, b_cl CLOB)<li> I run anonymous block that would insert into this table WITHOUT referencing CLOB column
begin
insert into misha_test (a) values (1);
commit;
end;2. I looked at generated logs via the LogMiner and found the following entries in V$LOGMNG_CONTENTS:
SQL_REDO
set transaction read write;
insert into "MISHA_TEST"("A","B_CL") values ('1',EMPTY_CLOB());
set transaction read write;
commit;
update "MISHA_TEST" set "B_CL" = NULL where "A" = '1' and ROWID = 'AAAj90AAKAACfqnAAA';
commit;And here I am puzzled: why do we have two operations for a single insert – first write EMPTY_CLOB into B_CL and then update it to NULL? But I didn’t even touch the column B_CL! Seems very strange – why can’t we write NULL to B_CL from the very beginning instead of first creating a pointer and than destroying it.
Key question:
- why NULL value in CLOB column should be handled differently than NULL value in VARCHAR2 column?
Test #2. Quantification
Question:
- having LOB column in the table seems to cause an overhead of generating more logs. But could it be quantified?
Assumption:
- My understanding is that CLOBs defined with “storage in row enabled = true” (default) up to ~ 4k of size behave like Varchar2(4000) and only when the size goes above 4k we start using real LOB mechanisms.
Basic test:
1. Two tables:
<li> With CLOB:
create table misha_test_clob2 (a_nr number primary key, b_tx varchar2(4000), c_dt date, d_cl CLOB)<li>With VARCHAR2:
create table misha_test_clob (a_nr number primary key, b_tx varchar2(4000), c_dt date, d_cl VARCHAR2(4000))2. Switch logfile/Insert 1000 rows and populate only A_NR/Switch logfile
insert into misha_test_clob (a_nr)
select level
from dual
connect by level < 10013. Check sizes of generated logs:
<li>With CLOB – 689,664 bytes
<li>With Varchar2 – 509.440 (<b>or about 26% reduction</b>)
Summary:
<li>the overhead is real. It means that table with VARCHAR2 column is cheaper to maintain, even if you are not using that column. So adding LOB columns to a table "just in case" is a really bad idea.
<li>Having LOB columns in the table that has tons of INSERT operations is expensive.
Just to clarify a real business case - I have a table with some number of attributes, one attribute has CLOB datatype. Frequency of inserts in this table is pretty high, frequency of using CLOB column is pretty low (NOT NULL ~0.1%). But because of that CLOB column I generate a lot more LOG data than I need (about 30% extra). Seems like a real waste of time! For now I requested development team to split the table into two, but that's still a bandage.
So, does anybody care? Comments/suggestions are very welcome!
Thanks a lot!
Michael RosenblumHello, everybody!
Sorry for the cross-post here and in "Database\SQL and PL/SQL" forum, but the problem I am trying to dig is somewhere between those two areas.
I need a bit of an advice whether the following behavior is wrong an requires SR to be initiated – or I am just missing something.
Setting:
- Oracle 11.2.0.3 Enterprise Edition 64-bit on Win 2008.
- Database is running in ARCHIVELOG mode with supplemental logging enabled
- DB_SECUREFILE=PERMITTED (so, by default LOBs will be created as BasicFiles - but I didn't notice any behavior difference comparing to SecureFile implementation)
Test #1. Initial discovery of a problem
1. Setup:
<li> I created a table MISHA_TEST that contains CLOB column
create table misha_test (a number primary key, b_cl CLOB)<li> I run anonymous block that would insert into this table WITHOUT referencing CLOB column
begin
insert into misha_test (a) values (1);
commit;
end;2. I looked at generated logs via the LogMiner and found the following entries in V$LOGMNG_CONTENTS:
SQL_REDO
set transaction read write;
insert into "MISHA_TEST"("A","B_CL") values ('1',EMPTY_CLOB());
set transaction read write;
commit;
update "MISHA_TEST" set "B_CL" = NULL where "A" = '1' and ROWID = 'AAAj90AAKAACfqnAAA';
commit;And here I am puzzled: why do we have two operations for a single insert – first write EMPTY_CLOB into B_CL and then update it to NULL? But I didn’t even touch the column B_CL! Seems very strange – why can’t we write NULL to B_CL from the very beginning instead of first creating a pointer and than destroying it.
Key question:
- why NULL value in CLOB column should be handled differently than NULL value in VARCHAR2 column?
Test #2. Quantification
Question:
- having LOB column in the table seems to cause an overhead of generating more logs. But could it be quantified?
Assumption:
- My understanding is that CLOBs defined with “storage in row enabled = true” (default) up to ~ 4k of size behave like Varchar2(4000) and only when the size goes above 4k we start using real LOB mechanisms.
Basic test:
1. Two tables:
<li> With CLOB:
create table misha_test_clob2 (a_nr number primary key, b_tx varchar2(4000), c_dt date, d_cl CLOB)<li>With VARCHAR2:
create table misha_test_clob (a_nr number primary key, b_tx varchar2(4000), c_dt date, d_cl VARCHAR2(4000))2. Switch logfile/Insert 1000 rows and populate only A_NR/Switch logfile
insert into misha_test_clob (a_nr)
select level
from dual
connect by level < 10013. Check sizes of generated logs:
<li>With CLOB – 689,664 bytes
<li>With Varchar2 – 509.440 (<b>or about 26% reduction</b>)
Summary:
<li>the overhead is real. It means that table with VARCHAR2 column is cheaper to maintain, even if you are not using that column. So adding LOB columns to a table "just in case" is a really bad idea.
<li>Having LOB columns in the table that has tons of INSERT operations is expensive.
Just to clarify a real business case - I have a table with some number of attributes, one attribute has CLOB datatype. Frequency of inserts in this table is pretty high, frequency of using CLOB column is pretty low (NOT NULL ~0.1%). But because of that CLOB column I generate a lot more LOG data than I need (about 30% extra). Seems like a real waste of time! For now I requested development team to split the table into two, but that's still a bandage.
So, does anybody care? Comments/suggestions are very welcome!
Thanks a lot!
Michael Rosenblum -
Hello Everyone,
Before I go to my question let me give you the context. I wanted to upload the description of a set of products with their IDs into my database. Hence I created a table 'demo' with two columns of INT and CLOB datatypes using the following script. *create table demo ( id int primary key, theclob Clob );*
Then I create a directory using the following script, *Create Or Replace Directory MY_FILES as 'C:\path of the folder.......\';*
In the above mentioned directory I create one .txt file for each product with the description of the product. Using the below script I created a procedure to load the contents of the .txt files into my 'demo' table.
*CREATE OR REPLACE*
*PROCEDURE LOAD_A_FILE( P_ID IN NUMBER, P_FILENAME IN VARCHAR2 ) AS*
*L_CLOB CLOB;*
*L_BFILE BFILE;*
*BEGIN*
*INSERT INTO DEMO VALUES ( P_ID, EMPTY_CLOB() )*
*RETURNING THECLOB INTO L_CLOB;*
*L_BFILE := BFILENAME( 'MY_FILES', P_FILENAME );*
*DBMS_LOB.FILEOPEN( L_BFILE );*
*DBMS_LOB.LOADFROMFILE( L_CLOB, L_BFILE,*
*DBMS_LOB.GETLENGTH( L_BFILE ) );*
*DBMS_LOB.FILECLOSE( L_BFILE );*
*END;*
After which I called the procedure using, *exec load_a_file(1, 'filename.txt' );*
When I queried the table like, select * from demo; I am getting the following output..... which is all fine.
ID THECLOB
1 "product x is an excellent way to improve your production process and enhance your turnaround time....."
_*QUESTION*_
When I did the exact same thing in my friend's machine and query the demo table, I get garbage value in the 'theclob' column (as shown below). The only difference is that mine is an enterprise edition of Oracle 11.2.0.1 and my friends is an Express edition of Oracle 11.2.0.2. Does this has anything to do with the problem?
1 猺⁁摶慮捥搠摡瑡潬汥捴楯渠捡灡扩汩瑩敳㨠扡牣潤攠獣慮湩湧Ⱐ灡湩挠慬敲琬⁷潲欠潲摥爠浡湡来浥湴Ⱐ睩牥汥獳潲浳湤異敲癩獯爠瑩浥湴特⸊潭整⁍潢楬攠坯牫敲㨠周攠浯獴潢畳琠灡捫慧攮⁐牯癩摥猠扵獩湥獳敳⁷楴栠愠捯浰汥瑥汹⁷楲敬敳猠潰敲慴楯湡氠浡湡来浥湴祳瑥洮⁉湣汵摥猠慬氠潦⁃潭整⁔牡捫敲❳敡瑵牥猠灬畳㨠䍡汥湤慲猬畴潭慴敤畳瑯浥爠捯浭畮楣慴楯湳Ⱐ睯牫牤敲⽩湶潩捥⁵灤慴楮朠晲潭⁴桥楥汤Ⱐ睯牫牤敲敱略湣楮本硣敳獩癥瑯瀠瑩浥汥牴猬⁷楲敬敳猠景牭猬⁴畲渭批畲渠癯楣攠湡癩条瑩潮Ⱐ慮搠浯牥⸊ੁ摶慮捥搠坩
2 ≁否吠潦晥牳摶慮捥搠睩牥汥獳潲浳慰慢楬楴礠睩瑨⁃潭整⁅娠䍯浥琬⁔牡捫敲湤⁃潭整⁍潢楬攠坯牫敲ਊ䍯浥琠䕚㨠周攠浯獴潢畳琬潳琠敦晥捴楶攠睥戠扡獥搠䵒䴠慰灬楣慴楯渠楮⁴桥湤畳瑲礮⁃慰慢楬楴楥猠楮捬畤攠䝐匠汯捡瑩潮⁴牡捫楮本⁷楲敬敳猠瑩浥汯捫Ⱐ来漭晥湣楮朠睩瑨汥牴猬灥敤湤瑯瀠瑩浥汥牴猬湤渭摥浡湤爠獣桥摵汥搠牥灯牴楮朮ਊ䍯浥琠呲慣步爺⁁⁰潷敲晵氠捬楥湴ⵢ慳敤⁰污瑦潲洠瑨慴晦敲猠慬氠瑨攠晥慴畲敳映䍯浥琠䕚⁰汵猺⁁摶慮捥搠摡瑡潬汥捴楯渠捡灡扩汩瑩敳㨠扡牣潤攠獣慮湩湧Ⱐ灡湩挠慬敲琬⁷潲欠潲摥爠浡湡来浥湴Ⱐ睩牥汥獳潲浳湤異敲癩獯爠瑩浥湴特⸊潭整⁍潢楬攠坯牫敲㨠周攠浯獴潢畳琠灡捫慧攮⁐牯癩摥猠扵獩湥獳敳⁷楴栠愠捯浰汥瑥汹⁷楲敬敳猠潰敲慴楯湡氠浡湡来浥湴祳瑥洮⁉湣汵摥猠慬氠潦⁃潭整⁔牡捫敲❳敡瑵牥猠灬畳㨠䍡汥湤慲猬畴潭慴敤畳瑯浥爠捯浭畮楣慴楯湳Ⱐ睯牫牤敲⽩湶潩捥⁵灤慴楮朠晲潭⁴桥楥汤Ⱐ睯牫牤敲敱略湣楮本硣敳獩癥瑯瀠瑩浥汥牴猬⁷楲敬敳猠景牭猬⁴畲渭批畲渠癯楣攠湡癩条瑩潮Ⱐ慮搠浯牥⸊ੁ摶慮捥搠坩牥汥獳⁆潲浳㨠呵牮湹⁰慰敲潲洠楮瑯⁷楲敬敳猠捬潮攠潦⁴桥慭攠楮景牭慴楯渠ⴠ湯慴瑥爠桯眠捯浰汩捡瑥搮⁓慶攠瑩浥礠瑲慮獦敲物湧湦潲浡瑩潮慣欠瑯⁴桥晦楣攠睩瑨⁷楲敬敳猠獰敥搮⁓慶攠灡灥爠慮搠敬業楮慴攠摵慬•ഊ
3 ≁䥒呉䵅⁍慮慧敲牯洠䅔♔⁰牯癩摥猠愠浯扩汥灰汩捡瑩潮猠摥獩杮敤⁴漠瑲慣欠扩汬慢汥潵牳⸠⁔桥⁁㑐潬畴楯湳畴潭慴楣慬汹潧⁷楲敬敳猠敭慩氬慬汳Ⱐ慮搠扩汬慢汥癥湴猬獳潣楡瑥猠瑨敭⁷楴栠捬楥湴爠灲潪散琠捯摥猠慮搠摩牥捴猠扩汬慢汥散潲摳⁴漠扩汬楮朠獹獴敭献†周攠呩浥乯瑥潬畴楯湳⁰牯癩摥汩浭敤潷渠數灥物敮捥Ⱐ慬汯睩湧潲牥慴楯渠潦慮畡氠扩汬慢汥癥湴献†周敲攠慲攠瑷漠癥牳楯渠潦⁁㑐湤⁔業敎潴攮ਊ䭥礠䙥慴畲敳㨊⨠䥮捬畤攠捡灴畲攠慤潣楬污扬攠敶敮瑳ਪ⁃慰瑵牥潢楬攠灨潮攠捡汬湤浡楬†慳楬污扬攠敶敮瑳Ⱐਪ⁁扩汩瑹⁴漠慳獩杮楬污扬攠敶敮琠瑯汩敮琠慮搠灲潪散琊⨠䅢楬楴礠瑯敡牣栠慮搠獣牯汬⁴桲潵杨楬污扬攠敶敮瑳Ⱐ潰瑩潮⁴漠楮瑥杲慴攠睩瑨楬汩湧祳瑥浳 ⨠偯瑥湴楡氠扥湥晩瑳湣汵摥湣牥慳敤⁰牯摵捴楶楴礠慮搠牥摵捥搠慤浩湩獴牡瑩癥癥牨敡搠湤湣牥慳敤敶敮略略⁴漠浯牥捣畲慴攠捡灴畲楮朠潦楬污扬攠敶敮瑳•ഊ
4 ≁灲楶慐慹⁁乄⁁灲楶慐慹⁐牯晥獳楯湡氠晲潭⁁否吠瑵牮⁹潵爠浯扩汥敶楣攠楮瑯⁰潲瑡扬攠捲敤楴慲搠瑥牭楮慬⸠坩瑨潭灡瑩扬攠䅔♔浡牴灨潮攬⁁灲楶慐慹爠䅰物癡偡礠偲潦敳獩潮慬潦瑷慲攬湤敲捨慮琠慣捯畮琬⁹潵爠浯扩汥⁷潲武潲捥慮⁰牯捥獳牥摩琠潲敢楴慲搠灡祭敮瑳牯洠瑨攠晩敬搮ਊ䭥礠䙥慴畲敳㨠 ⨠卭慲瑰桯湥ⵢ慳敤潬畴楯渠⁴漠灲潣敳猠捲敤楴慲搠灡祭敮瑳 ⨠䙵汬ⵦ敡瑵牥搠灯楮琭潦慬攠獯汵瑩潮異灯牴楮朠慬氠浡橯爠瑲慮獡捴楯渠瑹灥ਠ⨠卵灰潲瑳牥摩琠慮搠摥扩琠瑲慮獡捴楯湳 ਊ∍
To make sure that the .txt files are accessible in the directory I executed the following script, Host Echo Hello World > C:\...path...\1.Txt
After which I found the contents of the file changed to "Hello World". Later I loaded the .txt file with "Hello World" and queried the table. Still I am getting some garbage value. However since the string "Hello World" is much smaller than the previous contents, the garbage size is also smaller for ID 1. I don't get any errors, but you can see the output as follows.
1 䠀攀氀氀漀 圀漀爀氀搀 ഀ
2 ≁否吠潦晥牳摶慮捥搠睩牥汥獳潲浳慰慢楬楴礠睩瑨⁃潭整⁅娠䍯浥琬⁔牡捫敲湤⁃潭整⁍潢楬攠坯牫敲ਊ䍯浥琠䕚㨠周攠浯獴潢畳琬潳琠敦晥捴楶攠睥戠扡獥搠䵒䴠慰灬楣慴楯渠楮⁴桥湤畳瑲礮⁃慰慢楬楴楥猠楮捬畤攠䝐匠汯捡瑩潮⁴牡捫楮本⁷楲敬敳猠瑩浥汯捫Ⱐ来漭晥湣楮朠睩瑨汥牴猬灥敤湤瑯瀠瑩浥汥牴猬湤渭摥浡湤爠獣桥摵汥搠牥灯牴楮朮ਊ䍯浥琠呲慣步爺⁁⁰潷敲晵氠捬楥湴ⵢ慳敤⁰污瑦潲洠瑨慴晦敲猠慬氠瑨攠晥慴畲敳映䍯浥琠䕚⁰汵猺⁁摶慮捥搠摡瑡潬汥捴楯渠捡灡扩汩瑩敳㨠扡牣潤攠獣慮湩湧Ⱐ灡湩挠慬敲琬⁷潲欠潲摥爠浡湡来浥湴Ⱐ睩牥汥獳潲浳湤異敲癩獯爠瑩浥湴特⸊潭整⁍潢楬攠坯牫敲㨠周攠浯獴潢畳琠灡捫慧攮⁐牯癩摥猠扵獩湥獳敳⁷楴栠愠捯浰汥瑥汹⁷楲敬敳猠潰敲慴楯湡氠浡湡来浥湴祳瑥洮⁉湣汵摥猠慬氠潦⁃潭整⁔牡捫敲❳敡瑵牥猠灬畳㨠䍡汥湤慲猬畴潭慴敤畳瑯浥爠捯浭畮楣慴楯湳Ⱐ睯牫牤敲⽩湶潩捥⁵灤慴楮朠晲潭⁴桥楥汤Ⱐ睯牫牤敲敱略湣楮本硣敳獩癥瑯瀠瑩浥汥牴猬⁷楲敬敳猠景牭猬⁴畲渭批畲渠癯楣攠湡癩条瑩潮Ⱐ慮搠浯牥⸊ੁ摶慮捥搠坩牥汥獳⁆潲浳㨠呵牮湹⁰慰敲潲洠楮瑯⁷楲敬敳猠捬潮攠潦⁴桥慭攠楮景牭慴楯渠ⴠ湯慴瑥爠桯眠捯浰汩捡瑥搮⁓慶攠瑩浥礠瑲慮獦敲物湧湦潲浡瑩潮慣欠瑯⁴桥晦楣攠睩瑨⁷楲敬敳猠獰敥搮⁓慶攠灡灥爠慮搠敬業楮慴攠摵慬•ഊ
3 ≁䥒呉䵅⁍慮慧敲牯洠䅔♔⁰牯癩摥猠愠浯扩汥灰汩捡瑩潮猠摥獩杮敤⁴漠瑲慣欠扩汬慢汥潵牳⸠⁔桥⁁㑐潬畴楯湳畴潭慴楣慬汹潧⁷楲敬敳猠敭慩氬慬汳Ⱐ慮搠扩汬慢汥癥湴猬獳潣楡瑥猠瑨敭⁷楴栠捬楥湴爠灲潪散琠捯摥猠慮搠摩牥捴猠扩汬慢汥散潲摳⁴漠扩汬楮朠獹獴敭献†周攠呩浥乯瑥潬畴楯湳⁰牯癩摥汩浭敤潷渠數灥物敮捥Ⱐ慬汯睩湧潲牥慴楯渠潦慮畡氠扩汬慢汥癥湴献†周敲攠慲攠瑷漠癥牳楯渠潦⁁㑐湤⁔業敎潴攮ਊ䭥礠䙥慴畲敳㨊⨠䥮捬畤攠捡灴畲攠慤潣楬污扬攠敶敮瑳ਪ⁃慰瑵牥潢楬攠灨潮攠捡汬湤浡楬†慳楬污扬攠敶敮瑳Ⱐਪ⁁扩汩瑹⁴漠慳獩杮楬污扬攠敶敮琠瑯汩敮琠慮搠灲潪散琊⨠䅢楬楴礠瑯敡牣栠慮搠獣牯汬⁴桲潵杨楬污扬攠敶敮瑳Ⱐ潰瑩潮⁴漠楮瑥杲慴攠睩瑨楬汩湧祳瑥浳 ⨠偯瑥湴楡氠扥湥晩瑳湣汵摥湣牥慳敤⁰牯摵捴楶楴礠慮搠牥摵捥搠慤浩湩獴牡瑩癥癥牨敡搠湤湣牥慳敤敶敮略略⁴漠浯牥捣畲慴攠捡灴畲楮朠潦楬污扬攠敶敮瑳•ഊ
4 ≁灲楶慐慹⁁乄⁁灲楶慐慹⁐牯晥獳楯湡氠晲潭⁁否吠瑵牮⁹潵爠浯扩汥敶楣攠楮瑯⁰潲瑡扬攠捲敤楴慲搠瑥牭楮慬⸠坩瑨潭灡瑩扬攠䅔♔浡牴灨潮攬⁁灲楶慐慹爠䅰物癡偡礠偲潦敳獩潮慬潦瑷慲攬湤敲捨慮琠慣捯畮琬⁹潵爠浯扩汥⁷潲武潲捥慮⁰牯捥獳牥摩琠潲敢楴慲搠灡祭敮瑳牯洠瑨攠晩敬搮ਊ䭥礠䙥慴畲敳㨠 ⨠卭慲瑰桯湥ⵢ慳敤潬畴楯渠⁴漠灲潣敳猠捲敤楴慲搠灡祭敮瑳 ⨠䙵汬ⵦ敡瑵牥搠灯楮琭潦慬攠獯汵瑩潮異灯牴楮朠慬氠浡橯爠瑲慮獡捴楯渠瑹灥ਠ⨠卵灰潲瑳牥摩琠慮搠摥扩琠瑲慮獡捴楯湳 ਊ∍
Edited by: Arunkumar Gunasekaran on Jan 3, 2013 11:38 AM>
To make sure that the .txt files are accessible in the directory I executed the following script, Host Echo Hello World > C:\...path...\1.Txt
After which I found the contents of the file changed to "Hello World". Later I loaded the .txt file with "Hello World" and queried the table. Still I am getting some garbage value. However since the string "Hello World" is much smaller than the previous contents, the garbage size is also smaller for ID 1. I don't get any errors, but you can see the output as follows.
>
The most common problem I have seen using BFILEs is the character set; BFILEs do NOT handle character set conversion.
That is the main reason I don't recommend using BFILEs for loading data like this. Either SQL*Loader or external tables can do the job and they both handle character set conversions properly.
See the LOADFROMFILE Procedure of DBMS_LOB package in the PL/SQL Language doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_lob.htm#i998778
>
Note:
The input BFILE must have been opened prior to using this procedure. No character set conversions are performed implicitly when binary BFILE data is loaded into a CLOB. The BFILE data must already be in the same character set as the CLOB in the database. No error checking is performed to verify this.
Note:
If the character set is varying width, UTF-8 for example, the LOB value is stored in the fixed-width UCS2 format. Therefore, if you are using DBMS_LOB.LOADFROMFILE, the data in the BFILE should be in the UCS2 character set instead of the UTF-8 character set. However, you should use sql*loader instead of LOADFROMFILE to load data into a CLOB or NCLOB because sql*loader will provide the necessary character set conversions.
>
I suggest you use an external table definition to do this load. You can do an ALTER to change the file name for each load.
See External Tables Concepts in the Utilities doc for the basics
http://docs.oracle.com/cd/B28359_01/server.111/b28319/et_concepts.htm
See Altering External Tables in the DBA doc for detailed information
http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables013.htm
>
DEFAULT DIRECTORY
Changes the default directory specification
ALTER TABLE admin_ext_employees
DEFAULT DIRECTORY admin_dat2_dir;
LOCATION
Allows data sources to be changed without dropping and re-creating the external table metadata
ALTER TABLE admin_ext_employees
LOCATION ('empxt3.txt',
'empxt4.txt');
>
You can also load in parallel if you have licensed that option. -
VLD-2550 and 2551: CLOB datatype errors
Hi All
I've been trying to solve thi sproblem but have not been able to find a solution.
Basically I have a Col1 (of table A) of clob datatype which is to be mapped to Col2 (table B).
But when I validate the map I get the error:
VLD-2550 : BLOB,CLOB or NBLOB data from remote source cannot have transformations (validation details : If you have CLOB,BLOB as remote data source, it must be directly mapped to a target entity)
and
VLD-2551: BLOB LCOB or NBLOB from remote data source must have generation mode set to SET-BASED.
My map has a one to one mapping between the cols of tables A and B. Col1 is directly linked to Col2 (if thats what is meant by no transformations for CLOb types)
Thanks a lotHi ,
If your source table (which have the CLOB ) is in remote machine then you need to configure the mapping in SET base mode and you should directly connect that source column to the target column .
If you still get those kind of validation waring then simple ignore them .
It is a defect in OWB . Refer Bug 5989066 : VALIDATION OF MAP WITH BLOB OBJECTS THROWS VLD-2550 AND VLD-2551 WARNINGS , which is yet to be fixed .
Thanks,
Sutirtha -
I need to have several columns in a table say 14 which would each hold around 8k of data.
Now i want a solution for creating the table and retrieving data from that particular table.
I want this solution to be as simple as possible. No triggers and no procedures.
Some one please help urgentlyShobana,
Try using something like this.
select * from clob_test
where to_char(clob_col) like 'key%'
It depends on the datatype you are inserting
into that column.
I actually don't what CLOB datatype is
since you are comparing with a char datatype
this should work.
AO
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Shobana ([email protected]):
Hi,
I have a CLOB datatype column in a table and I want to select few rows from that table by comparing that column with some static value as mentioned below. How can I do that?
create table clob_test( clob_col clob );
insert into clob_test values('keys');
insert into clob_test values('key board');
insert into clob_test values('monitor');
commit;
I want something like :-
select * from clob_test where clob_col like 'key%' to get 2 rows. This doesn't work. Gives an error as 'Inconsistent datatypes'
Casting also doesn't work.
This doesn't work. Is there any other way for this problem (other than DBMS_LOB package)?
Would be great if any of you can help me out.
Thanks in advance<HR></BLOCKQUOTE>
null -
CLOB Datatype (Assgin more than 32k fails)
Dear All
Can anyone tell me why i am getting this error if i assign more than 32k character to clob variable in pl/sql
but i can assign it from table to a variable
Pl/sql 1(ORA-06502: PL/SQL: numeric or value error: character string buffer too small)
declare
c clob;
v varchar(32767);
begin
for i in 1..90000 (just assuming it as 90k)
loop
v:=v||'x';
if length(v) > 31000 then
c:=c||v; -- here iam getting error while assigning character to clob if it is more than 32k
v:=null;
end if;
end loop;
c:=v;
end;
Pl/sql 2 (works fine when assgin from table)
declare
c clob;
begin
select clob_data into c from x; -- clob data is more than 32k;
end;
But it works fine with database 9i rel2 but in 11g i am facing this problem.
Regardshey U r getting the error because of v varchar(32767) , but clob data type can take large amont of data atleast 1000000 this much data can be stored in clob data type try it with this. or else see below
Hi see the example below
create table temp(col clob);
declare
v_string clob;
begin
for i in 1..1000000
v_string:=v_string||'A';
end loop;
insert into temp values(v_string);
end;
now
select length(col) from temp; you will get output as
length(col)
1000000
this means that clob datatype can store minimum of 1000000 character. -
How to retrieve data from a field of CLOB datatype?
How can I retrieve data from a field of CLOB datatype in Oracle
8 being called from an ASP or VB application? The recordset
object in ASP or VB doesn't support the CLOB datatype.
Thank you in advance for your help.How can I retrieve data from a field of CLOB datatype in Oracle
8 being called from an ASP or VB application? The recordset
object in ASP or VB doesn't support the CLOB datatype.
Thank you in advance for your help. Hello.. were you able to solve your problem? I'm faced with pretty much the same task.. I have a VBA application that needs to pull various pieces of data(CLOBs, BLOBs, etc..) from an Oracle8i db.
Maybe you are looking for
-
Different Aggregation rule while aggregating
Hi Folks in OBIEE 10.1.3.4.1 and BI Apps 7.9.6, using answers, i developed a report which has Organization division dimension and active headcounts as fact. while the report is created, the default aggregation( Server determined) rule that the server
-
Sales order item details with condition types
Hi Guys, I am uploading the sales order details using DIRECT INPUT method in LSMW, one line item having 5 condition types, but in the item level structure BVBAKPOM, I can able to MAP only four condition types. Is there any way to map more then 4 con
-
[Solved] Rxvt-Unicode-256colors , -pe tabbed extension problem.
Hello. I use rxvt-unicode-256colors for long time. Wheb try to run -pe tabbed extension I got following errors: iurxvt: Can't call method "parent" on an undefined value at /usr/lib/urxvt/perl/tabbed line 82. urxvt: Can't call method "focus_in" on an
-
Deskjet 1512 prints colors/images too dark
Colors come out excessively dark, worthless for printing in color.
-
Hi, I have Lenovo G770 with model number 1037. I want to replace my 750 GB HDD with some good SSD drive for performance reason. can you please tell me if there is any good SSD Drive which would go best with Lenovo G770. Regards Aaqib Solved! Go to