Varchar2 column versus variable memory allocation in pl/sql

167 views Asked by At

In pl/sql, if you create a variable as varchar2(256) and then assign a 10 character string to the variable then the total memory used is 256 characters but if you declare it (4000 or more it will use only the 10 characters. Is that also true for varchar columns on a table? Or does a varchar column always allocate only what you have assigned? Thanks.

1

There are 1 answers

0
bowlturner On

The varchar column is meant to be 'variable character' so it stores just one more character (the terminal) than the string you are storing. char, stores exactly the number of characters it is set to.