I have been very interesting to know that when we declare a variable such as varchar2(10)
, some fixed amount of memory will be allocated. We can estimate it by printing/displaying output. It have some empty strings in that length where there are no characters.
Interestingly while for varchar2
it just displays the string that we entered/stored in the database earlier without having empty strings.
My question is how these are stored, is it already fixed upto the given length or Is memory allocated to the length we have declared or only for the string that we store in it.
Example: If I declare varchar2(10)
and store string "Hello" then will the memory allocated to all the 10 characters as declared or allocated only to the 5 letter string I have stored.
Can anyone one please explain.