Solved

size of varchar2

Posted on 2013-12-10
5
516 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 250 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 250 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
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.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

726 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