views:

8208

answers:

6

What is the maximum length of a table name in Oracle? For bonus points, what is the maximum length of a column name?

+1  A: 

In the 10g database I'm dealing with, I know table names are maxed at 30 characters. Couldn't tell you what the column name length is (but I know it's > 30).

Harper Shelby
Column names are limited to 30 characters as well, not > 30
Justin Cave
Ah, I see that (in Mark Brady's answer). I could've sworn I saw one longer, but obviously I was wrong.
Harper Shelby
+12  A: 

I believe the maximum name size is 30 characters, because all table/index names must be stored in the data dictionary and that storage is only allocated for 30 characters

EDIT-

The same goes for the column name

TStamper
Don't just give the fish, give him a rod and reel
why the downvote, for the correct answer?
TStamper
Did you assume that I gave you the -1 and give me -one for spite? It wasn't me
Wow...lol..sorry been a member for a few months now and only gave one downvote and it was to spam
TStamper
I wasn't worried about the downvote I got. Just wanted to let you know that I wasn't the one who downvoted, just the one who commented and not everyone who downvotes comments and vice-versa
I never assumed you downvoted me,the comment was for all, I didnt comment on your answer, so I never suspected you. sorry you took it that way
TStamper
+19  A: 

Teach a man to fish

Notice the data-type and size

>describe all_tab_columns

VIEW all_tab_columns

Name                                      Null?    Type                        
 ----------------------------------------- -------- ----------------------------
 OWNER                                     NOT NULL VARCHAR2(30)                
 TABLE_NAME                                NOT NULL VARCHAR2(30)                
 COLUMN_NAME                               NOT NULL VARCHAR2(30)                
 DATA_TYPE                                          VARCHAR2(106)               
 DATA_TYPE_MOD                                      VARCHAR2(3)                 
 DATA_TYPE_OWNER                                    VARCHAR2(30)                
 DATA_LENGTH                               NOT NULL NUMBER                      
 DATA_PRECISION                                     NUMBER                      
 DATA_SCALE                                         NUMBER                      
 NULLABLE                                           VARCHAR2(1)                 
 COLUMN_ID                                          NUMBER                      
 DEFAULT_LENGTH                                     NUMBER                      
 DATA_DEFAULT                                       LONG                        
 NUM_DISTINCT                                       NUMBER                      
 LOW_VALUE                                          RAW(32)                     
 HIGH_VALUE                                         RAW(32)                     
 DENSITY                                            NUMBER                      
 NUM_NULLS                                          NUMBER                      
 NUM_BUCKETS                                        NUMBER                      
 LAST_ANALYZED                                      DATE                        
 SAMPLE_SIZE                                        NUMBER                      
 CHARACTER_SET_NAME                                 VARCHAR2(44)                
 CHAR_COL_DECL_LENGTH                               NUMBER                      
 GLOBAL_STATS                                       VARCHAR2(3)                 
 USER_STATS                                         VARCHAR2(3)                 
 AVG_COL_LEN                                        NUMBER                      
 CHAR_LENGTH                                        NUMBER                      
 CHAR_USED                                          VARCHAR2(1)                 
 V80_FMT_IMAGE                                      VARCHAR2(3)                 
 DATA_UPGRADED                                      VARCHAR2(3)                 
 HISTOGRAM                                          VARCHAR2(15)
+1  A: 

The schema object naming rules may also be of some use:

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements008.htm#sthref723

carpenteri
A: 

DESCRIBE all_tab_columns

will show a TABLE_NAME VARCHAR2(30)

Note VARCHAR2(30) means a 30 byte limitation, not a 30 character limitation, and therefore may be different if your database is configured/setup to use a multibyte character set.

Mike

+1  A: 

Right, but as long as you use ASCII characters even a multibyte character set would still give a limitation of exactly 30 characters... so unless you want to put hearts and smiling cats in you're DB names your fine...

Maarten

Maarten
I can DO that? Cool! *shoots self*
Ed Daniel