Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: VARCHAR - Physical storage question
Ben Heuer wrote:
>
> Hello
>
> I'd like to know how the VARCHAR handles the data? I understand
> that it allocates only the amount of space that the column
> actually contains? But what if the column content is modified?
>
> For instance, lets say I have
>
> USER_NAME VARCHAR2(20)
>
> Now, I do an insert:
>
> INSERT INTO TABLE VALUES ('BEN HEUER')
>
> This is just 9 characters. I undrstand that physically only 9
> chars will be allocated?
>
> Now, lets say I update this field to BEN_HEUER_1234. How does
> the varchar physically allocate space for it, because there must
> be records after the original record as well...is a separate
> space created for it and these two are related based on
> something?
>
> Thanks!
>
> -----------------------------------------------------------
>
> Got questions? Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com
VC2 stores the length of the data and the data itself, so an extra byte or so plus your original data.
If you update a row so that its larger than it was originally, Oracle will attempt to use space in the same block to hold the row, if that fails, it will move it to another block.
Have a read up on Chaining, Migration, PCTFREE
HTH
-- =========================================== Connor McDonald http://www.oracledba.co.uk We are born naked, wet and hungry...then things get worseReceived on Sat Jul 29 2000 - 00:00:00 CDT
![]() |
![]() |