Operating environment: oracle10g sqlplus Environment. In a query statement, an error often occurs: SQL Base: ORA-00918: An error that does not explicitly define a column.
There are two situations that are currently encountered. The reason is: when the query statement, the query's table (dataset) has the same field name, query field can not be confirmed to check that field , an error that does not explicitly define the column is reported.
In the first case: 1. When one table: For example, there are three fields in the Fconsign table: Fcsg_consign_id,fcsg_consign_type,fcsg_consign_status Select fcsg_consign_id from (select fcsg_consign_id,fcsg_consign_type,fc.* from Fconsign FC) T This SQL statement is an error, because there are two fields in T fcsg_consign_id, causing the DBMS to be unable to determine which column to query Select Fcsg_consign_status from (select fcsg_consign_id,fcsg_consign_type,fc.* from Fconsign FC) T This will not be an error, T fcsg_consign_status only one, so there will be no error.
All in all: in a nested query, a field in an outer query can only appear in a subquery, otherwise you cannot determine which field to look up. Errors that do not explicitly define the column are reported.
2. Multi-table Joint query For example, there is a field in the table A,b.
Select a from a,b this will be an error. Because it's not sure which column to check. You need to explicitly define A.A or B.A (if you alias a table after the from statement, such as When select S_no,s_name,s_score,s.class_no,class_name from student S joins Class C on (S.class_no = c.class_no), the SELECT statement The same field name that is owned by more than one table also needs to be identified with an alias such as: S.class_no.
Reproduced from: http://blog.csdn.net/wxdsdtc831/article/details/7432774 |