Error ora-00918 [message #327333] |
Mon, 16 June 2008 02:07 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sweetkhaliq
Messages: 200 Registered: April 2006
|
Senior Member |
![sweetkhaliq%40yahoo.com](/forum/theme/orafaq/images/yahoo.png)
|
|
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 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 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>
|
|
|
|