Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: 2000 character limitation problem
A copy of this was sent to keathley_at_writeme.com
(if that email address didn't require changing)
On Fri, 05 Jun 1998 15:49:57 GMT, you wrote:
>Any help will be greatly appreciated:
>
>I have defined a table in my Oracle db with the following schema:
> test(a varchar2(2) not null, b long)
>Where a is my identifier and b is of type long.
>My problem is this, Long can support up to 2gb of data, but I
>am unable to enter anything over 2000 characters because of
>Oracle's 2000 max chars on quoted strings. Triggers and Functions
>have proven useless. Please help!!!
>
>Thanks,
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...
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading
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 Fri Jun 05 1998 - 11:23:38 CDT
![]() |
![]() |