Home » RDBMS Server » Server Administration » How much characters in varchar2 length 4000?
How much characters in varchar2 length 4000? [message #372526] Tue, 20 February 2001 04:01 Go to next message
Mucky
Messages: 7
Registered: February 2001
Junior Member
Can anyone tell me how much charakters i can put in a varchar2 field with length 4000?
How can i calculate this?
It seems that the max. number of characters in such a field is 2000.
THX
Re: How much characters in varchar2 length 4000? [message #372532 is a reply to message #372526] Tue, 20 February 2001 17:20 Go to previous messageGo to next message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
In 8i (my version 8.1.5) I can do the following and it works fine...

set serveroutput on;

declare
v_str varchar2(32767);
begin
v_str := lpad( 'a', 32767, 'b');
dbms_output.put_line('length is '||length(v_str));
end;
Re: How much characters in varchar2 length 4000? [message #372542 is a reply to message #372526] Wed, 21 February 2001 03:37 Go to previous messageGo to next message
Mucky
Messages: 7
Registered: February 2001
Junior Member
Hi Andrew,

thanks, but iīm not that much into oracle, so i donīt understand what your solution is good for and how to do it. Can i get with your solution the length of a varchar2 field?
I tried to put 2000 characters in a varchar2 field length 2000, and it works. But when i try to put more than 2060 charakters in a varchar2 field length 4000 i become an error. Whatīs the problem?

sorry for my ignorance...
Re: How much characters in varchar2 length 4000? [message #372545 is a reply to message #372542] Wed, 21 February 2001 09:34 Go to previous messageGo to next message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
-- Create a test table in sqlplus
create table big_varchar4000 (col1 varchar2(4000));

-- try inserting some test data
insert into big_varchar4000 values (lpad( 'a', 4000, 'b'));

-- lpad( 'a', 4000, 'b') creates a string like "bbbb...bbbba" of total length 4000

-- check the length of the actual data inserted
select length(col1) from big_varchar4000;

This is only abailable in Oracle 8.x, it was 2000 in Oracle 7.x
Re: How much characters in varchar2 length 4000? [message #372583 is a reply to message #372526] Mon, 26 February 2001 07:58 Go to previous message
Mucky
Messages: 7
Registered: February 2001
Junior Member
Hi,

nobody else got an answer?
Previous Topic: Tranasction Counter
Next Topic: Re: Slow Sql that access Large Data
Goto Forum:
  


Current Time: Sat May 18 04:00:12 CDT 2024