Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: REQ: How to insert a 15K text string into a CLOB field?

Re: REQ: How to insert a 15K text string into a CLOB field?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 23 Jul 2001 18:34:41 -0700
Message-ID: <9jijbh01ie5@drn.newsguy.com>

In article <9jhci4$bd8$1_at_news.usf.edu>, "Kerberos" says...
>
>This is a multi-part message in MIME format.
>
>------=_NextPart_000_00A6_01C1129A.A7634950
>Content-Type: text/plain;
> charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>If you can, please email to ddanh_at_invisiondev.com.
>
>Thanks.
>
>REQ: How to insert a 15K text string into a CLOB field?
>
>

there are so many ways to do it, the best way is dependent on your client language.

See
http://technet.oracle.com/doc/oracle8i_816/appdev.816/index.htm for details -- there are entire documents on this.

A quick and dirty way:

ops$tkyte_at_ORA8I.WORLD> create table t ( x clob );

Table created.

ops$tkyte_at_ORA8I.WORLD>
ops$tkyte_at_ORA8I.WORLD> create or replace procedure insert_15k( p_string in long )
  2 as
  3 l_clob clob;
  4 begin
  5 insert into t (x) values ( empty_clob() ) returning x into l_clob;   6
  7 dbms_lob.writeappend( l_clob, length(p_string), p_string );   8 end;
  9 /

Procedure created.

ops$tkyte_at_ORA8I.WORLD> 
ops$tkyte_at_ORA8I.WORLD> 
ops$tkyte_at_ORA8I.WORLD> exec insert_15k( rpad( '*', 16000, '*' ) );

PL/SQL procedure successfully completed.

ops$tkyte_at_ORA8I.WORLD>
ops$tkyte_at_ORA8I.WORLD> select dbms_lob.getlength(x) from t;

DBMS_LOB.GETLENGTH(X)


                16000

1 row selected.

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Mon Jul 23 2001 - 20:34:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US