[Oracle]ORA-00918: 열의 정의가 애매합니다 column ambiguously defined

### Cause: java.sql.SQLSyntaxErrorException: ORA-00918: 열의 정의가 애매합니다 ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00918: 열의 정의가 애매합니다



1. 오류명: ORA-00918: 열의 정의가 애매합니다.


2. 원   인: 조회 시에 테이블에 같은 이름의 COLUMN이 있고, alias를 사용하지 않은 상태에서 SELECT 할 때 어떤 COLUMN의 값을 사용할 지 알 수 없기 때문에 나는 오류. 


3. 해결법: 

3-1. ALIAS 지정.

3-2. SELECT 문에서 둘 중에 한 COLUMN 제거.

3-3. 앞에서 ALIAS를 지정했는데 뒤에서 안 쓰고 있는지 확인.





### Cause: java.sql.SQLSyntaxErrorException: ORA-00918: column ambiguously defined ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00918: column ambiguously defined



1. Error name: ORA-00918: column ambiguously defined.

2. Cause: I have a COLUMN with the same name in the table at the time of the query, and cannot know which COLUMN value to use when SELECTing without using an alias.

3. Workaround: 

3-1. Assign ALIAS.

3-2. Remove one COLUMN from the SELECT statement.

3-3. After specifying ALIAS in front, check that it is not used at the back.

반응형