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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Inserting into a LONG datatype

Re: Inserting into a LONG datatype

From: <bcfyjd_at_my-dejanews.com>
Date: Sat, 09 Jan 1999 19:36:44 GMT
Message-ID: <778b4d$qch$1@nnrp1.dejanews.com>


In article <36a534f2.95140134_at_192.86.155.100>,   tkyte_at_us.oracle.com wrote:
> A copy of this was sent to dolans_at_stripe.Colorado.EDU (Sean Dolan)
> (if that email address didn't require changing)
> On 5 Jan 99 15:25:16 GMT, you wrote:
>
> >I have a table that has a LONG datatype column. I have an SQL statement
> >that has a very long string (3200 characters to be exact), but when I try to
> >insert it into the table, I get an ORA-01704: String too long error.
> >
> >How do I get a very long string into a LONG datatype through an SQL
> >statement?
> >
> >Thanks,
> >Sean Dolan
> >sean_at_3si.com
>
> you need to use bind variables for
> larger strings instead of character string constants.
>
> One method in SQL plus 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...
>
> 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.
>

Hi

I've got the problem kinda similar to Sean's. I need to put text data from external file to Oracle table, so I create table with the field L of long type and .. what to do now? I have text strings about 5-6 k long, I use Visual Basic program to put it into the table and get the error message mentioned above. What would you do? Any hints will be very appreciated

Please, reply to my e-mail also

Thanks a lot
Dmitri Issanov

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Sat Jan 09 1999 - 13:36:44 CST

Original text of this message

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