Maximum identifiers in Oracle Database 12c Release 2 (12.2)


Oracle database 12c Release 2 (12.2) increases the maximum size of most identifiers from 30 to 128 bytes, which makes migration possible from other database engines such as SQL Server or MySQL.






Why Need Long Identifiers

At some point every DBA or developer will have hit a point where the 30 character limit for object names has caused a problem. This limit can be extremely painful when doing migration projects from SQL Server or MySQL to Oracle. In Oracle Database 12c R2, the maximum length of most identifiers is now 128 characters.

CREATE TABLE this_is_a_table_to_hold_employees_please_dont_put_customers_in_it (
  this_is_the_primary_key_column_which_uniquely_identifies_the_row  NUMBER,
  this_is_for_the_employee_name_so_dont_put_other_crap_in_it        VARCHAR2(100),
  CONSTRAINT this_is_a_table_to_hold_employees_please_dont_put_customers_in_it_pk
    PRIMARY KEY (this_is_the_primary_key_column_which_uniquely_identifies_the_row)
);

Table created.

SQL>

As expected, this change has filtered through many areas of the system including the dictionary views and JVM.

SQL> desc dba_tables
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 OWNER                                     NOT NULL VARCHAR2(128)
 TABLE_NAME                                NOT NULL VARCHAR2(128)
 TABLESPACE_NAME                                    VARCHAR2(30)
 CLUSTER_NAME                                       VARCHAR2(128)
 IOT_NAME                                           VARCHAR2(128)
 STATUS                                             VARCHAR2(8)
 .
 .
 .
 CONTAINER_MAP_OBJECT                               VARCHAR2(3)

SQL>





Backwards Compatibility


If you are in a situation where you are supporting multiple versions of the database, you will need to avoid using long identifier names, or you will prevent backwards compatibility.

No comments:

Powered by Blogger.