Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem with insert and long field
A copy of this was sent to "Yves Sandfort" <Y.Sandfort_at_philyve.net>
(if that email address didn't require changing)
On Mon, 6 Jul 1998 12:57:41 +0200, you wrote:
>We have an application which uses long fields for storing textdata. The
>original import was done via sqlloadr and odbc. Both worked, but now updates
>and insertions should go via odbc and they won´t work if the field value is
>longer than 2000 characters. We have already tried to split the strings and
>then concat them but concat has the same limitation.
>
>If someone has an solution please EMail it to me
>y.sandfort_at_philyve.net
>
>Thanks
> Yves Sandfort
>
what language are you using to get stuff in? 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)......
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 Government
Herndon VA
http://govt.us.oracle.com/ -- downloadable utilities
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 Mon Jul 06 1998 - 09:04:07 CDT
![]() |
![]() |