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

前端 未结 10 1359
遥遥无期
遥遥无期 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:35

    In addition to cagcowboy's point that it derives from the SQL standard (historically, I suspect that Oracle's decision lead to the SQL standard since Oracle predated the standardization of SQL), I would wager that a large part of the reluctance to allow longer identifiers comes from the realization that there are millions of DBAs with millions of custom scripts that all assume that identifiers are 30 characters long. Allowing every line of code that goes something like

      l_table_name VARCHAR2(30);
    BEGIN
      SELECT table_name
        INTO l_table_name
        FROM dba_tables
       WHERE ...
    

    to suddenly break because the DBA 15 years ago used VARCHAR2(30) rather than DBA_TABLES.TABLE_NAME%TYPE in the script would cause massive revolt. I would wager that Oracle alone has thousands of places where this sort of thing has been done over the years in various packages and components. Retrofitting all that existing code to support longer identifiers would be a tremendous project that would almost certainly generate way more costs in developer time, QA time, and newly introduced bugs than it would generate benefits.

提交回复
热议问题