Error ora-00918 [message #327333] |
Mon, 16 June 2008 02:07 |
sweetkhaliq
Messages: 200 Registered: April 2006
|
Senior Member |
|
|
Dear Members
i am facing the problem that when i run the report it gave this error. ORA-00198 column ambiguously defined.
,decode(==>client,'P','H-NO TOWN',DIST_STATE) as distat
I am using developer 6i and 9i database.
Please tell me what is the problem.
Thanks
|
|
|
Re: Error ora-00918 [message #327343 is a reply to message #327333] |
Mon, 16 June 2008 02:58 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I suspect that query contains two or more tables, and two or more of them contain column with the same name; furthermore, you didn't use table name or its alias while writing the query, so Oracle doesn't know which table you are selecting from.
Here's an example:
SQL> select deptno, ename --> no table alias
2 from emp e, dept d
3 where e.deptno = d.deptno;
select deptno, ename
*
ERROR at line 1:
ORA-00918: column ambiguously defined
SQL> select d.deptno, e.ename --> using table alias
2 from emp e, dept d
3 where e.deptno = d.deptno;
DEPTNO ENAME
---------- ----------
20 SMITH
30 ALLEN
30 WARD
20 JONES
30 MARTIN
30 BLAKE
10 CLARK
20 SCOTT
10 KING
30 TURNER
20 ADAMS
30 JAMES
20 FORD
10 MILLER
14 rows selected.
SQL>
|
|
|
|