Skip to Main Content
  • Questions
  • creating a table with columns longer than 30 characters

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question.

Asked: September 24, 2015 - 8:08 am UTC

Last updated: April 27, 2023 - 1:10 pm UTC

Version: 11.1.2

Viewed 100K+ times! This question is

You Asked

Hi All,
I am creating a table dynamically whose one column name exceeds more than 30 characters.So i am not able to create the table .

I tried by keeping the column name within double quotes( " "). But it throw me the same error.

is there any way to achieve this ?

Regards
jagannath

and Chris said...

No, it isn't possible to do this. As stated in the docs, the maximum length of object name (tables, columns, triggers, packages, etc.) is 30 bytes:

http://docs.oracle.com/database/121/SQLRF/sql_elements008.htm#SQLRF51129

The only exceptions are database names (8 byte limit) and database links (128 bytes).

UPDATE: 16 Aug 2017

As of Oracle Database 12.2, the maximum length of names increased to 128 bytes (provided compatible is set to 12.2 or higher). Database names are still limited to 8 bytes. And the names of disk groups, pluggable databases (PDBs), rollback segments, tablespaces, and tablespace sets are limited to 30 bytes.

http://docs.oracle.com/database/122/SQLRF/Database-Object-Names-and-Qualifiers.htm#SQLRF51129

Rating

  (12 ratings)

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

Comments

Terrible shortcoming - 30 character limit

A reader, September 28, 2015 - 1:27 pm UTC

This is really a terrible shortcoming. Rating is for the feature not available and not on the post reply.

Even with 12c this limit has not increased while they have increases varchar2 from 4000 to 32k.

When will oracle do this ?

This has been so annoying in creating self documenting column names, constraint names etc. I know we can add comments, still.

Is this an Os implementation limitation ?

Tharindu, August 16, 2017 - 4:42 am UTC

Character Limit was increased to 128 on 12c R2
http://docs.oracle.com/database/122/NEWFT/new-features.htm
Chris Saxon
August 16, 2017 - 1:33 pm UTC

Yes, indeed it has :)

Answer makes us perfect

GAURAV, January 31, 2018 - 9:14 am UTC

Makes us clear about the object names which will future errors

Answer makes us perfect

GAURAV, January 31, 2018 - 9:15 am UTC

Makes us clear about the object names which will avoid future errors

Oracle streams restrictions

Aleksey, February 14, 2020 - 12:41 pm UTC

Hello,

Is this a special note or something else, which describe that oracle streams does not support a column name large then 30 characters?

We use streams in 12.2 database and discovered, that despite the database limit is 128 characters, streams don't work with column nmae larger then 30 characters, and ignore dml on this column without errors or something else.
Connor McDonald
February 17, 2020 - 1:45 am UTC

https://docs.oracle.com/database/121/UPGRD/deprecated.htm#UPGRD60000

Streams deprecated in 12.1 and desupported after 18.

So you could make an argument to Support that 12.2 and 18 (and the longer column names) should be available to you because Streams is supported in those releases.

However, in reality....thats a bit like swimming against the tide. Streams is going away.

30 is enough

Žilvinas, April 08, 2020 - 12:34 pm UTC

Hello,
My personal opinion that 30 symbols for the name is even too much.
Our DBAs do not enable that "feature" and they do the right thing. It was Oracle mistake to let longer names than 30 symbols.
It is terribly bad design to write stories in name.
It is awfully inconvenient to read names longer that 30 symbols. Until you finish reading end of the name you forget the beginning. And if there is where clause with many ANDs and ORs you can go insane with names longer than 30 symbols.
It is not readable, not writable and worst thing you can do with your naming system.
Chris Saxon
April 08, 2020 - 3:37 pm UTC

Are names longer than 30 bytes really that big a problem?

You can't disable them unless you keep compatible at 12.1 or lower. In which case you're also missing out on a bunch of other features added from 12.2 onwards. Seems like a high price to pay to me.

Marco van der Linden, April 09, 2020 - 8:55 am UTC

There's worse things than long column names such as "ColumnNamesInAnimalsWithHumpsOnTheirBacksNotatition".

As for rating of this topic, as almost any topic on this forum, it is very useful and over the years I've gained a lot of knowledge on Oracle and its possibilities (and impossibilities).

Thanks to you guys on the team and all other contributors
Chris Saxon
April 09, 2020 - 9:36 am UTC

Thanks!

Longer names are necessary

Waldo, November 07, 2021 - 4:17 pm UTC

As the data has become richer and more complex, longer names are necessary. Oracle must advance and modernize according to the demands of the market and the advances of the competition. We must move forward. Greetings.
Connor McDonald
November 09, 2021 - 3:57 am UTC

Well you have 128 now. Surely that is enough?

And we cannot even disable the thing

Peter G, November 14, 2021 - 5:38 pm UTC

SQL> set lines 128
SQL> select * from very_modern;

SOME_INSANELY_LONG_COLUMN_NAME_THAT_HOPEFULLY_NOT_EVEN_WALDO_WOULD_EVER_COME_UP_WITH
------------------------------------------------------------------------------------
                                                                                  40

1 row selected.

SQL>

table name with more than 30 characters.

Rajeshwaran, Jeyabal, August 22, 2022 - 12:30 pm UTC

Team,

here is my ddl run from 21c database and it works.

However when i enter this table name and column name from the Oracle SQL Developer data modeler (latest version 22.2) table properties popup window - get into an error while clicking "OK/Apply" option.

Error : some_big_table_with_really_name_having_more_than_30_chars: Name has more than 30 characters

so can you help us how to overcome from this error/limitation from data modeling tool?

demo@PDB1> CREATE TABLE some_big_table_with_really_name_having_more_than_30_chars (
  2         some_big_table_with_really_name_having_more_than_30_chars_c1 VARCHAR2(30 CHAR)
  3     );

Table created.

Connor McDonald
August 23, 2022 - 10:38 pm UTC

Target version of the database is important.

table name with more than 30 characters.

Rajeshwaran, Jeyabal, August 23, 2022 - 2:53 pm UTC

Team,

Please ignore my above request, found the answer by myself.

go to SQL Data modeler browser window, select the "Relational model" --> "new relational model" --> right click on the "Relational_1" and select "properties" option, changed the "RDBMS Type" from "Oracle database 11g" to "Oracle database 12c or 12cR2 or 21c" solved the above error.
Connor McDonald
August 23, 2022 - 10:38 pm UTC

Ah.... you got there in the end :-)

Oracle 12.1.0.2.0 reports 128 howevre

Spyros Economopoulos, April 24, 2023 - 11:54 am UTC

Hello,

can you please explain the below?

 select *
 from v$version;


> Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

 SELECT data_length
 FROM all_tab_columns
 WHERE table_name = 'USER_TABLES'
 AND column_name = 'TABLE_NAME';


> 128

I would expect the result to be 30 in that release
Chris Saxon
April 27, 2023 - 1:10 pm UTC

Often changes to prepare for a new feature are put in place in versions before it's publicly released

More to Explore

Design

New to good database design? Check out Chris Saxon's full fundamentals class.