Skip to Main Content
  • Questions
  • How many columns can be added in a table

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Muhammad.

Asked: December 12, 2005 - 9:02 pm UTC

Last updated: June 05, 2013 - 2:26 pm UTC

Version: 9i

Viewed 50K+ times! This question is

You Asked

Dear Tom,

I was going through oracle9i database concept and when i was reading the chapter1 i got a doubt. Could you please clarify it?


"Oracle stores each row of a database table containing data for less than 256 columns as one or more row pieces."

from oracle9i database concept under the topic

"Database Structure and Space Management Overview"
"Logical Database Structures"
"Tables"

I remember that i have seen somewhere in your reply we can create infinite number of columns for a table! is that right? Then what is this 256 columns refer to or am i missing out something here?

Thanks & Regards,
Ibrahim.

and Tom said...

No, you may have upto 1,000 columns in a table these days.

If you have more than 255 - they will be stored in multiple row pieces (like a chained row - the first 255 point to the next 255 point to the next 255 and so on)

Rating

  (7 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

never knew the rows were stored in chain for more than 255 columns

Vijay, December 14, 2005 - 4:20 am UTC

Hi Tom,
good day to you, I knew the maximum number of columns for a table are 1000,but didn't know that if more than 255 columns are there in a table the rows are stored in chained way, I never came across a table having requirement of 255 or more columns so in case there's a requirement of more than 255 columns then will the chaining impact performance and why is the limit in chunks of 255, only just curious.

Kind Regards,
Vijay

Tom Kyte
December 14, 2005 - 8:32 am UTC

because 255 is the biggest number a byte can store.

the limit used to be 255.

rather than change the entire format of a block, they kept it at 255 - but allow for chaining of multiple pieces.

Single or Multiple table?

A reader, March 01, 2007 - 1:17 pm UTC

Hi Tom

I have some data in one of the existing table of 30 columns. As per the new requirement there are 15 more attributes added to it.

1. Most of the time these data are required by the clients separately
2.The newly added set of data is optional.
3. The newly added set is either present for all the rows or not present in any of the rows

Should I have a new table or add columns to the existing table?


Tom Kyte
March 02, 2007 - 12:53 pm UTC

#3 is very confusing

if it is present for all rows - it is not optional
if it is not present for any row - it is not there

Oracle 10g

Bibin, August 31, 2012 - 12:40 am UTC

What is the maximum number of tables we can created in oracle 10g ?
Tom Kyte
September 10, 2012 - 6:26 pm UTC

in theory, infinite.

in reality, your mind would be blown before you get to the limit.

it would be restricted only by the size of the system tablespace.

Thanks a lot

Vasant Chauhan, October 05, 2012 - 6:20 am UTC

Thank you so much.




I have added multiple columns as required by me......

Columns in a Table

Sana, June 05, 2013 - 12:00 pm UTC

what is maximum number of columns in Oracle 11G? What is the impact of Normalization in table creation when it goes beyond 255 columns? Jus for information Im asking this question. Any answers or suggestion will be appreciated.
Tom Kyte
June 05, 2013 - 2:26 pm UTC

1,000 is the documented maximum
http://docs.oracle.com/cd/E11882_01/server.112/e25513/limits003.htm




... hat is the impact of
Normalization in table creation when it goes beyond 255 columns? ....


same impact as when it goes beyond 5? I'm not sure what you are looking for here. What do you mean by "impact".

It would be rare to have a entity with hundreds of attributes, many times when I see that, i see attribute named "x_1, x_2, x_3, .... x_100" - meaning they are not normalizing...


Mastan, April 29, 2015 - 12:08 pm UTC

DECLARE
gtable varchar2(30):='&givtablename';
cnt number(38):=&numofcolumns;
BEGIN
execute immediate 'create table '||gtable||'(col1 number(2))';
for i in 2..cnt
LOOP
execute immediate 'alter table '||gtable||' add col'||i||' '||'number(2)';
END LOOP;
END;

Check above syntax and Run ,it let us know the limit of columns in a table

Mastan, April 29, 2015 - 12:10 pm UTC