Why are Oracle table/column/index names limited to 30 characters?

前端 未结 10 1316
遥遥无期
遥遥无期 2020-11-30 20:26

I can understand that many years ago there would be this kind of limitation, but nowadays surely this limit could easily be increased. We have naming conventions for objects

相关标签:
10条回答
  • 2020-11-30 20:51

    I was looking this up and found this question via Google, but also found out that as of Oracle 12c Release 2 (12.2), this is no longer strictly the case. (https://oracle-base.com/articles/12c/long-identifiers-12cr2)

    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 12cR2, the maximum length of most identifiers is now 128 characters.

    This is a new feature in 12.2, according to (http://blog.dbi-services.com/oracle-12cr2-long-identifiers/). According to that post, 12.1 was still limited to 30 characters.


    Edit: Here's a link to the official Oracle documentation explaining the change. (https://docs.oracle.com/cloud/latest/exadataexpress-cloud/CSDBF/longer-identifier-names.htm#CSDBF-GUID-F4CA155F-5A37-4705-8443-0A8C9E3F875C)

    Starting with Oracle Database 12c Release 2 (12.2), the maximum length of identifier names for most types of database objects has been increased to 128 bytes.

    0 讨论(0)
  • 2020-11-30 20:54

    I believe that the 30 character identifier length comes from COBOL which was standardised in the late 1950s. Since COBOL programs were the main user of SQL (and SEQUEL before that (and QUEL before that)), this must have seemed like a reasonable number for the identifier length.

    0 讨论(0)
  • 2020-11-30 20:55

    Constraint violations get reported in SQLERRM which is limited to 255 characters, and which most clients use to make errors visible. I suspect increasing the allowable size of constraint names significantly would impact the ability to report on the violations (especially where a constraint violation has been bubbled up through a few layers of PL/SQL code).

    0 讨论(0)
  • 2020-11-30 20:55

    ok, the limitation exists....

    but do you really NEED more than to 30 character to name a table/index/column??

    when writing queries, with that limitation I STILL find some column/table names annoying. If the limit were higher I might run into tables that required a query like:

    select unique_identifier_column, 
    time_when_the_user_remembered_to_change_the_row_in_the_receipt_table, 
    foreign_key_to_the_ap_invoice_distributions_history_table_related_to_the_all_rows_table 
    from ap_invoices_really_really_all_all_rows_present_in_this_ebs_table.
    

    I apologize for the huge words :P

    0 讨论(0)
提交回复
热议问题