Home » SQL & PL/SQL » SQL & PL/SQL » size of varchar2 in pl/sql
size of varchar2 in pl/sql [message #240337] Thu, 24 May 2007 11:33 Go to next message
rolex.mp
Messages: 161
Registered: February 2007
Senior Member
i came to know that maximum size of varchar2 in a program unit can be 32767 bytes .
Does it mean that the complete storage area is fixed as of char datatype or does it allocate size only to the amount which is actually stored inside the variable .
Re: size of varchar2 in pl/sql [message #240339 is a reply to message #240337] Thu, 24 May 2007 11:36 Go to previous messageGo to next message
DreamzZ
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
no its not like char.char is static but its dynamic.
yes VARCHAR2 datatype allocate size only to the amount which is actually stored inside the variable .

[Updated on: Thu, 24 May 2007 11:38]

Report message to a moderator

Re: size of varchar2 in pl/sql [message #240422 is a reply to message #240337] Thu, 24 May 2007 15:49 Go to previous message
SnippetyJoe
Messages: 63
Registered: March 2007
Location: Toronto, Canada
Member
Here's what the PL/SQL User's Guide says about this (see VARCHAR2 Datatype).

Quote:
"Small VARCHAR2 variables are optimized for performance, and larger ones are optimized for efficient memory use. The cutoff point is 2000 bytes. For a VARCHAR2 that is 2000 bytes or longer, PL/SQL dynamically allocates only enough memory to hold the actual value. For a VARCHAR2 variable that is shorter than 2000 bytes, PL/SQL preallocates the full declared length of the variable. For example, if you assign the same 500-byte value to a VARCHAR2(2000 BYTE) variable and to a VARCHAR2(1999 BYTE) variable, the former takes up 500 bytes and the latter takes up 1999 bytes."



--
Joe Fuda
SQL Snippets
Previous Topic: How to count records from a population?
Next Topic: DB LINK for OPS$ user
Goto Forum:
  


Current Time: Fri Dec 02 18:27:11 CST 2016

Total time taken to generate the page: 6.43315 seconds