Oracle does not explicitly define columns

Source: Internet
Author: User
Tags one table

in a query statement, an error often occurs:
SQL Foundation: ORA-00918: Error with column not explicitly defined.

There are two kinds of situations currently encountered. The reason is: when the query statement, the query table (dataset) has the same field name, the query field can not be confirmed that the field is changed
, errors that do not explicitly define the column are reported.

First case:
1. Single-table:
For example, there are three fields in a 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 will get an error because the FCSG_CONSIGN_ID has two fields in T, causing the DBMS to not 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 that will not be an error.

In Summary: In a nested query, the field of the outer query can only appear in a subquery, otherwise it is not possible to determine which field to check. Errors that do not explicitly define the column are reported.

2. Multi-table Joint query
For example, there is a field in table A and B.
Select a from a A, this will be an error. Because it's impossible to determine

Which column. Need to explicitly define A.A alive B.A (if the table is aliased after the from statement, such as select S_no,s_name,s_score,s.class_no,class_name from student S join Class C on (S.C Lass_no = c.class_no), the same field name that is owned by more than one table in the SELECT statement also needs to be identified with an alias such as:s.class_no.)

Oracle does not explicitly define columns

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.