?
Solved

size of varchar2

Posted on 2013-12-10
5
Medium Priority
?
520 Views
Last Modified: 2013-12-10
What is the max size of VARCHAR2? How many zeros it can hold? -
0
Comment
Question by:d27m11y
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1000 total points
ID: 39709116
VARCHAR2 in a table or SQL: 4000 bytes.

In PL/SQL code: 32K.

The docs have this:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/datatypes.htm#CHDDCGEE

>>How many zeros it can hold?

As many as can fit given the constraints above and your character set?
0
 
LVL 8

Expert Comment

by:5teveo
ID: 39709118
http://www.orafaq.com/faq/what_is_the_difference_between_varchar_varchar2_and_char_data_types

'Varchar2' appears to hold 4000 characters vs 2000 of 'varchar'
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39709123
>>'Varchar2' appears to hold 4000 characters vs 2000 of 'varchar'

Incorrect.  It's bytes not characters.  If the database is using a multi-byte characterset the maximum number of characters is reduced.  For example: a 2-byte characterset the maximum is 2000 characters.
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 1000 total points
ID: 39709179
depends on the version.

up through version 7,  varchar2 had a limit of 2000 bytes
from version 8 through 11gR2  varchar2 has a limit of 4000 bytes

in 12c, default limit is 4000 bytes, but you can extend it to 32767 bytes but they are stored externally like LOB segments

All of those are for SQL limits.

In pl/sql, varchar2 can hold up to 32767 bytes
0
 
LVL 15

Expert Comment

by:Franck Pachot
ID: 39709458
Hi,
As 'zero' is probably not a multibyte character, you can store 4000 of them. But I'm not sure it's a good idea to store zeros like that.
Regards,
Franck.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question