Why doesn't Oracle tell you WHICH table or view does not exist?

前端 未结 8 1327
时光取名叫无心
时光取名叫无心 2021-01-31 13:43

If you\'ve used Oracle, you\'ve probably gotten the helpful message \"ORA-00942: Table or view does not exist\". Is there a legitimate technical reason the message doesn\'t incl

8条回答
  •  甜味超标
    2021-01-31 14:19

    SQL*Plus does tell you the table that doesn't exist. For example:

    SQL> select
      2     *
      3  from
      4     user_tables a,
      5     non_existent_table b
      6  where
      7     a.table_name = b.table_name;
       non_existent_table b
       *
    ERROR at line 5:
    ORA-00942: table or view does not exist
    

    Here it shows that the name of the missing table and the line number in the SQL statement where the error occurs.

    Similarly, in a one-line SQL statement you can see the asterisk highlighting the name of the unknown table:

    SQL> select * from user_tables a, non_existent_table b where a.table_name = b.table_name;
    select * from user_tables a, non_existent_table b where a.table_name = b.table_name
                                 *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    

    In terms of your question, I guess the reason the error message doesn't include the name of the table is that the error message itself needs to be static text. The line number and location in the line of the error is clearly passed back to SQL*Plus (somehow).

提交回复
热议问题