Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2004
    Posts
    6

    Unanswered: Variable column sizes

    I have a column in one if my tables that will hold an array of alphnumeric, comma delimited strings. The size of the column could vary. I see that if I declare the column VARCHAR2 it can hold upto 4000 bytes.

    If I declare a column to be 4000 bytes long and it is empty or only has 100 bytes of data stored in it how much space is that taking up? (i.e a 100 bytes worth or the full 4000 bytes)

    Also is there a way to redefine the size of the column without losing any of the data it current has? So if the Max length is 500 and I need to add more data to that field can I make the column 600 bytes and not lose the 500 bytes worth of data already in that field.

    Thanks,
    Craig

  2. #2
    Join Date
    Oct 2004
    Posts
    145
    VARCHAR2 will only allocated the space of the data, ie 100bytes worth will only use 100 bytes.

    Data type CHAR will pre-allocate all 4000 bytes.

    In increasing the column width if you issue an alter command, it will retain the existing data. Only time you loose the data is if you attempt to REDUCDE the size or change the data type definition.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    What's preventing you from doing some testing/experimentation on your own to actually see for yourself how Oracle behaves?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  4. #4
    Join Date
    Oct 2004
    Posts
    6
    Thanks JimYoo



    anacedent,

    The fact that I have never worked with oracle before, I have very little sql experience, and I am flying by the seat of my pants on this new assignment.

    One of the purpose of forums like is to help those of us who are clueless.

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    With free advice, in some cases you get what you paid for it.
    In some cases, answers are/can be VERY much version, OS, and/or site dependent.
    What works for user A, may not work for you.
    As The Great Communicator (R. Regan) once said, "Trust, but verify".
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •