Solved

size of varchar2

Posted on 2013-12-10
5
509 Views
Last Modified: 2013-12-10
What is the max size of VARCHAR2? How many zeros it can hold? -
0
Comment
Question by:d27m11y
5 Comments
 
LVL 76

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 76

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 73

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle TEXT search question 9 48
case statement in where clause 5 41
Maintaining Oracle Managed Accounts 2 29
Oracle query output question 4 36
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now