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

Home -> Community -> Usenet -> c.d.o.server -> Re: HELP! Need to enter string from Web bigger than 2000 characters

Re: HELP! Need to enter string from Web bigger than 2000 characters

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 06 Feb 1999 14:38:50 GMT
Message-ID: <36c553af.5006348@192.86.155.100>


A copy of this was sent to jedmonson_at_peavey.com (if that email address didn't require changing) On Fri, 05 Feb 1999 22:48:44 GMT, you wrote:

>Hello,
>
>I am programming an app for Internet use that needs to enter a text field into
>an Oracle database that is longer than 2000 characters. My DBA has given me a
>field of LONG type, but the SQL statement won't allow me to send anything over
>the 2000 char limit. When I concat multiple strings together that add up over
>2000, the same error occurs.
>
>How do I get around this. I know Oracle will hold over 2 GBs in this field,
>but how do I get the large amount of text into it????
>

what language are you using to get stuff in? you need to use bind variables for larger strings instead of character string constants. Sounds like you might just be building an insert statement like:

  insert into my_table values ( 'string longer then 2000 characters or 4000 characters in oracle8 ......' );

One method that works upto 32k is as such:

drop table demo;
create table demo ( x long );

declare

    myvar long default '

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(lots of stuff here)......
';
begin

   insert into demo values ( myvar );
   dbms_output.put_line( length( myvar ) ); end;

The pl/sql variable can be initialized to upto 32k of static text. It can then be inserted into the table (it is a bind variable, not a constant at that point).

For example, I just ran it and it showed me:

Table dropped.

Table created.

24726

PL/SQL procedure successfully completed.

So, that put a 24,726 character string into the table...

So, instead of building an insert statement, build a pl/sql block that does the insert and execute that instead.

>Thanks for your time....
>
>John Edmonson
>jedmonson_at_peavey.com
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Sat Feb 06 1999 - 08:38:50 CST

Original text of this message

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