How do I concatenate CLOB datatypes ?
I'm using Select dbms_lob.substr(Table1.Column, 4000) from Table1 to bring in the clob text ..
But the maximum length of the CLOB text field in the column is 51465....
so I'm trying to concatenate the column field from the same column...
How can we i bring in the whole text from the column?
How can we i bring in the whole text from the column?Why not simply
Select Table1.Column from Table1?
btw.:
clobs can be concatenated with the || (concat) operator:
SQL> select length(lpad (to_clob ('x'), 50000, 'x')
|| lpad (to_clob ('y'), 50000, 'y')) clob_length
from dual
CLOB_LENGTH
100000Edited by: michaels2 on May 14, 2009 8:00 AM
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 -
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. -
How to display and edit the clob datatype column from Data base
Hi ,
I have a requiremsnt as below
1) One Table having some columns with CLOB data type along with varchar columns
2) need to display the data from DB in search screen and need to be edited clob column in edit screen
I created EO and VO with that Table and how to display the clob value into the input box for editing.
using Jdev 11.1.1.5.0 version.
Can you please help on this.
THanks & REgards,
MadhuHi,
If you are using an inputText component to display a Character Large Object (CLOB), then you will need to create a custom converter that converts the CLOB to a String.
For custom convertor refer below link,
http://docs.oracle.com/cd/E2438201/web.1112/e16181/af_validate.htm#BABGIEDH
(section7.4 Creating Custom JSF Converters)
Thanks,
Santosh M E -
How to copy a table with LONG and CLOB datatype over a dblink?
Hi All,
I need to copy a table from an external database into a local one. Note that this table has both LONG and CLOB datatypes included.
I have taken 2 approaches to do this:
1. Use the CREATE TABLE AS....
SQL> create table XXXX_TEST as select * from XXXX_INDV_DOCS@ext_db;
create table XXXX_TEST as select * from XXXX_INDV_DOCS@ext_db
ERROR at line 1:
ORA-00997: illegal use of LONG datatype
2. After reading some threads I tried to use the COPY command:
SQL> COPY FROM xxxx/pass@ext_db TO xxxx/pass@target_db REPLACE XXXX_INDV_DOCS USING SELECT * FROM XXXX_INDV_DOCS;
Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)
CPY-0012: Datatype cannot be copied
If my understanding is correct the 1st statement fails because there is a LONG datatype in XXXX_INDV_DOCS table and 2nd one fails because there is a CLOB datatype.
Is there a way to copy the entire table (all columns including both LONG and CLOB) over a dblink?
Would greatelly appriciate any workaround or ideas!
Regards,
Pawel.Hi Nicolas,
There is a reason I am not using export/import:
- I would like to have a one-script solution for this problem (meaning execute one script on one machine)
- I am not able to make an SSH connection from the target DB to the local one (although the otherway it works fine) which means I cannot copy the dump file from target server to local one.
- with export/import I need to have an SSH connection on the target DB in order to issue the exp command...
Therefore, I am looking for a solution (or a workaround) which will work over a DBLINK.
Regards,
Pawel. -
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; -
Load Clob datatype into xml db
Hi All,
Please can I know how to load clob datatype in xml database.
In Oracle Data Integrator mapping, my source is clob column and target is xml db.
I get error “incompatible data type in conversion”.
Please can I get some help in resolving the issue.
Thanks.Also tried
http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/t_xml.htm
getStringVal funtion
but it cannot handle more than 4000 characters.
Please can I know how to map clob source to xml db in ODI -
Hello,
Does anyone have any examples of how a CLOB datatype can be returned from a stored procedure and used in java?
Currently we are building up strings and returning a VARCHAR2 datatype, but are running into the 32k size restriction as some of the strings are too long.
It seems that converting the strings to CLOBs and then returning is the best solution. Has anyone had a similar problem and solved it?
Regards,
EoinCreate stored procedure like this :
create or replace procedure getclob(var out clob) as
str varchar2(20);
templob CLOB;
begin
str :='mystring';
DBMS_LOB.CREATETEMPORARY(templob, TRUE, dbms_lob.session);
dbms_lob.write(templob,length(str),1,str);
var :=templob;
DBMS_LOB.FREETEMPORARY(templob);
end;
java program to call above stored procedure
import java.sql.*;
import oracle.jdbc.driver.*;
class SPLobInJava
public static void main(String args[]) throws Exception
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@insn104:1521:ora9idb", "scott", "tiger");
CallableStatement cs;
cs = conn.prepareCall("{call getclob(?)}");
cs.registerOutParameter(1,java.sql.Types.CLOB);
cs.execute();
Clob clob =cs.getClob(1);
// do whatever you want with the clob
System.out.println(clob.getSubString(1,5));
cs.close();
conn.close();
} -
Passing CLOB datatype to a stored procedure
Hi,
How do I pass a CLOB value to a stored procedure?
I am creating a stored procedure which appends a value to a CLOB datatype. The procedure has 2 in parameter (one CLOB and one CLOB). The procedure is compiled but I'm having problem executing it. Below is a simplified version of the procedure and the error given when the procedure is executed.
SQL> CREATE OR REPLACE PROCEDURE prUpdateContent (
2 p_contentId IN NUMBER,
3 p_body IN CLOB)
4 IS
5 v_id NUMBER;
6 v_orig CLOB;
7 v_add CLOB;
8
9 BEGIN
10 v_id := p_contentId;
11 v_add := p_body;
12
13 SELECT body INTO v_orig FROM test WHERE id=v_id FOR UPDATE;
14
15 DBMS_LOB.APPEND(v_orig, v_add);
16 commit;
17 END;
18 /
Procedure created.
SQL> exec prUpdateContent (1, 'testing');
BEGIN prUpdateContent (1, 'testing'); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'PRUPDATECONTENT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Any help or hints please.
nullsorry I made a mistake with the in parameter types - it's one NUMBER and one CLOB.
-
Can we check CLOB datatype to null?
Hi ,
i want check clob datatype to null so i have used decode(col1,null,n1,n2) ..it executes the query but it gives nothing ..doesn't return data only show o ..
can you please tell me how to do ?Take a look at http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_lob.htm#ARPLS66622
CONVERTTOBLOB Procedure
Regards
Etbin -
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 with JDBC Adapter
Hi,
we try to fill a Clob Datatype to JDBC Database.
We try 2 ways with the JDBC Adapter:
action="SQL_DML" with an SQL Statment and $placeholders$
But how can i say the key element that it is a CLOB type?
He used this a VARCHAR and there a not more than 4k Chars allowed.
second way is action="EXECUTE" to call a Stored Procedure, but there we got the error that CLOB type is an Unsupported feature.
Any Idea?
Regards,
Robin
Message was edited by: Robin SchroederOk i will check this...
But i'm right when i say that the only way to fill CLOB Type is to use a Stored Procedure ?
or is there any possibility to do this with action="SQL_DML" ?
Regards,
Robin -
Problem in execution of a function having clob datatype
[http://www.orafaq.com/forum/t/128331/98870/]
Hi,
I had a Problem in executing a function having clob datatype.
Here below is my function.
create or replace type split_obj as object
occurence_id number(10,0),
splitvalue varchar2(1000)
create or replace type split_rec as table of split_obj;
create or replace FUNCTION Split_new1(
p_string IN clob,
p_delimiter IN VARCHAR2
) return split_rec pipelined is
v_length NUMBER := dbms_lob.getlength(p_string);
v_start NUMBER := 1;
v_index NUMBER;
V_temp NUMBER(10,0):=0;
begin
WHILE(v_start <= v_length)
LOOP
v_index := dbms_lob.INSTR(p_string, p_delimiter, v_start);
IF v_index = 0 THEN
V_temp:=V_temp+1;
PIPE ROW(split_obj(v_temp,dbms_lob.SUBSTR(p_string, v_length,v_start)));
v_start := v_length + 1;
ELSE
v_temp:=v_temp+1;
PIPE ROW(split_obj(v_temp,dbms_lob.SUBSTR(p_string, v_index - v_start,v_start)));
v_start := v_index + 1;
END IF;
END LOOP;
return;
end Split_new1;Here attached link contains the procedure trying to execute the function with huge string more than 400kb.
Could you pls let me know how to do the same in sqlplus and toad.
Thanks in advance.
Edited by: user512743 on Nov 27, 2008 4:31 AMBluShadow wrote:
The problem is that in your execution of this you are trying to assign a value to the clob variable using
v_clob := '<string>'
where the string is greater than allowed in PL/SQL.
Whilst the CLOB itself can hold more data, the string is actually the equivalent of a VARCHAR2 so cannot exceed VARCHAR2 limits.
You should use the DBMS_LOB package to append data to your CLOB in chunks of no more than 32767 characters at a time.??? PL/SQL provides full CLOB support. There is no need to use DBMS_LOB (although you could). OP's function has logic errors. Anyway:
SQL> create or replace type split_obj as object
2 (
3 occurence_id number(10,0),
4 splitvalue varchar2(1000)
5 );
6 /
Type created.
SQL> create or replace type split_rec as table of split_obj;
2 /
Type created.
SQL> create or replace
2 FUNCTION Split_new1(
3 p_string IN clob,
4 p_delimiter IN VARCHAR2
5 )
6 return split_rec pipelined
7 is
8 v_length NUMBER := length(p_string);
9 v_start NUMBER := 1;
10 v_end NUMBER;
11 V_id NUMBER :=0;
12 v_clob CLOB := p_string || p_delimiter;
13 begin
14 while(v_start <= v_length) loop
15 v_end := instr(v_clob, p_delimiter, v_start);
16 v_id := v_id + 1;
17 pipe row(split_obj(v_id,substr(p_string,v_start,v_end - v_start)));
18 v_start := v_end + length(p_delimiter);
19 end loop;
20 return;
21 end Split_new1;
22 /
Function created.
SQL> create table test_table(x clob)
2 /
Table created.
SQL> declare
2 c clob;
3 begin
4 for i in 1..26 loop
5 c := c || lpad(chr(ascii('a') + i - 1),1000,chr(ascii('a') + i - 1)) || ',';
6 end loop;
7 for i in 1..26 loop
8 c := c || lpad(chr(ascii('A') + i - 1),1000,chr(ascii('A') + i - 1)) || ',';
9 end loop;
10 for i in 1..26 loop
11 c := c || lpad(chr(ascii('a') + i - 1),1000,chr(ascii('a') + i - 1)) || ',';
12 end loop;
13 for i in 1..26 loop
14 if i > 1 then c := c || ','; end if;
15 c := c || lpad(chr(ascii('A') + i - 1),1000,chr(ascii('A') + i - 1));
16 end loop;
17 insert into test_table
18 values(c);
19 end;
20 /
PL/SQL procedure successfully completed.
SQL> select length(x)
2 from test_table
3 /
LENGTH(X)
104103
SQL> select t.occurence_id,
2 length(splitvalue) len,
3 substr(splitvalue,1,20) first_20
4 from test_table,
5 table(Split_new1(x,',')) t
6 /
OCCURENCE_ID LEN FIRST_20
1 1000 aaaaaaaaaaaaaaaaaaaa
2 1000 bbbbbbbbbbbbbbbbbbbb
3 1000 cccccccccccccccccccc
4 1000 dddddddddddddddddddd
5 1000 eeeeeeeeeeeeeeeeeeee
6 1000 ffffffffffffffffffff
7 1000 gggggggggggggggggggg
8 1000 hhhhhhhhhhhhhhhhhhhh
9 1000 iiiiiiiiiiiiiiiiiiii
10 1000 jjjjjjjjjjjjjjjjjjjj
11 1000 kkkkkkkkkkkkkkkkkkkk
OCCURENCE_ID LEN FIRST_20
12 1000 llllllllllllllllllll
13 1000 mmmmmmmmmmmmmmmmmmmm
14 1000 nnnnnnnnnnnnnnnnnnnn
15 1000 oooooooooooooooooooo
16 1000 pppppppppppppppppppp
17 1000 qqqqqqqqqqqqqqqqqqqq
18 1000 rrrrrrrrrrrrrrrrrrrr
19 1000 ssssssssssssssssssss
20 1000 tttttttttttttttttttt
21 1000 uuuuuuuuuuuuuuuuuuuu
22 1000 vvvvvvvvvvvvvvvvvvvv
OCCURENCE_ID LEN FIRST_20
23 1000 wwwwwwwwwwwwwwwwwwww
24 1000 xxxxxxxxxxxxxxxxxxxx
25 1000 yyyyyyyyyyyyyyyyyyyy
26 1000 zzzzzzzzzzzzzzzzzzzz
27 1000 AAAAAAAAAAAAAAAAAAAA
28 1000 BBBBBBBBBBBBBBBBBBBB
29 1000 CCCCCCCCCCCCCCCCCCCC
30 1000 DDDDDDDDDDDDDDDDDDDD
31 1000 EEEEEEEEEEEEEEEEEEEE
32 1000 FFFFFFFFFFFFFFFFFFFF
33 1000 GGGGGGGGGGGGGGGGGGGG
OCCURENCE_ID LEN FIRST_20
34 1000 HHHHHHHHHHHHHHHHHHHH
35 1000 IIIIIIIIIIIIIIIIIIII
36 1000 JJJJJJJJJJJJJJJJJJJJ
37 1000 KKKKKKKKKKKKKKKKKKKK
38 1000 LLLLLLLLLLLLLLLLLLLL
39 1000 MMMMMMMMMMMMMMMMMMMM
40 1000 NNNNNNNNNNNNNNNNNNNN
41 1000 OOOOOOOOOOOOOOOOOOOO
42 1000 PPPPPPPPPPPPPPPPPPPP
43 1000 QQQQQQQQQQQQQQQQQQQQ
44 1000 RRRRRRRRRRRRRRRRRRRR
OCCURENCE_ID LEN FIRST_20
45 1000 SSSSSSSSSSSSSSSSSSSS
46 1000 TTTTTTTTTTTTTTTTTTTT
47 1000 UUUUUUUUUUUUUUUUUUUU
48 1000 VVVVVVVVVVVVVVVVVVVV
49 1000 WWWWWWWWWWWWWWWWWWWW
50 1000 XXXXXXXXXXXXXXXXXXXX
51 1000 YYYYYYYYYYYYYYYYYYYY
52 1000 ZZZZZZZZZZZZZZZZZZZZ
53 1000 aaaaaaaaaaaaaaaaaaaa
54 1000 bbbbbbbbbbbbbbbbbbbb
55 1000 cccccccccccccccccccc
OCCURENCE_ID LEN FIRST_20
56 1000 dddddddddddddddddddd
57 1000 eeeeeeeeeeeeeeeeeeee
58 1000 ffffffffffffffffffff
59 1000 gggggggggggggggggggg
60 1000 hhhhhhhhhhhhhhhhhhhh
61 1000 iiiiiiiiiiiiiiiiiiii
62 1000 jjjjjjjjjjjjjjjjjjjj
63 1000 kkkkkkkkkkkkkkkkkkkk
64 1000 llllllllllllllllllll
65 1000 mmmmmmmmmmmmmmmmmmmm
66 1000 nnnnnnnnnnnnnnnnnnnn
OCCURENCE_ID LEN FIRST_20
67 1000 oooooooooooooooooooo
68 1000 pppppppppppppppppppp
69 1000 qqqqqqqqqqqqqqqqqqqq
70 1000 rrrrrrrrrrrrrrrrrrrr
71 1000 ssssssssssssssssssss
72 1000 tttttttttttttttttttt
73 1000 uuuuuuuuuuuuuuuuuuuu
74 1000 vvvvvvvvvvvvvvvvvvvv
75 1000 wwwwwwwwwwwwwwwwwwww
76 1000 xxxxxxxxxxxxxxxxxxxx
77 1000 yyyyyyyyyyyyyyyyyyyy
OCCURENCE_ID LEN FIRST_20
78 1000 zzzzzzzzzzzzzzzzzzzz
79 1000 AAAAAAAAAAAAAAAAAAAA
80 1000 BBBBBBBBBBBBBBBBBBBB
81 1000 CCCCCCCCCCCCCCCCCCCC
82 1000 DDDDDDDDDDDDDDDDDDDD
83 1000 EEEEEEEEEEEEEEEEEEEE
84 1000 FFFFFFFFFFFFFFFFFFFF
85 1000 GGGGGGGGGGGGGGGGGGGG
86 1000 HHHHHHHHHHHHHHHHHHHH
87 1000 IIIIIIIIIIIIIIIIIIII
88 1000 JJJJJJJJJJJJJJJJJJJJ
OCCURENCE_ID LEN FIRST_20
89 1000 KKKKKKKKKKKKKKKKKKKK
90 1000 LLLLLLLLLLLLLLLLLLLL
91 1000 MMMMMMMMMMMMMMMMMMMM
92 1000 NNNNNNNNNNNNNNNNNNNN
93 1000 OOOOOOOOOOOOOOOOOOOO
94 1000 PPPPPPPPPPPPPPPPPPPP
95 1000 QQQQQQQQQQQQQQQQQQQQ
96 1000 RRRRRRRRRRRRRRRRRRRR
97 1000 SSSSSSSSSSSSSSSSSSSS
98 1000 TTTTTTTTTTTTTTTTTTTT
99 1000 UUUUUUUUUUUUUUUUUUUU
OCCURENCE_ID LEN FIRST_20
100 1000 VVVVVVVVVVVVVVVVVVVV
101 1000 WWWWWWWWWWWWWWWWWWWW
102 1000 XXXXXXXXXXXXXXXXXXXX
103 1000 YYYYYYYYYYYYYYYYYYYY
104 1000 ZZZZZZZZZZZZZZZZZZZZ
104 rows selected.
SQL> As you can see, function works OK without DBMS_LOB on CLOB of 104103 bytes.
SY.
Maybe you are looking for
-
Hey guys and gals new to the forum and new to the Mac world. I use to have a dell but recently purchased a power book g4 probably should have waited for the pro. Anyways I love this thing but I cannot access some of the features on my work web site b
-
Upgrading from Mac OS X 10.3 - 10.4 and eventually 10.4.6!
I want to upgrade my system software to the latest 10.4.6. I am at present running 10.3.9 but have noticed that you have to go all the way back to 10.4 before you can proceed. I have tried to find 10.4 in Apples downloads options but have not been ab
-
How to align (center) field's content in the section (band) limits
The environment is: CR version: CR version: CR 10.2.3600 VS version: VS 2005 Prof + C# Application type: Windows application The Text objects can have set crHorCenterAlign property. There are no similar crVertCenterAlign property. So, how can we ve
-
Hello Oracle Community, DB: 11.1.0.7.0 How can I see what database objects (tables, indexes, etc.) are stored in a given tablespace and what is the best way to shrink the size of a tablespace/datafiles ? IKrischer
-
EXCEL error: There was a problem sending the command to the program.
Using EXCEL from Office 2010. Have tried all the solutions - no change. Any new ideas - 2014?