Home » SQL & PL/SQL » SQL & PL/SQL » ORA-00918 : column ambiguously defined. Please help
ORA-00918 : column ambiguously defined. Please help [message #19398] Thu, 14 March 2002 07:42 Go to next message
Nina
Messages: 113
Registered: March 2000
Senior Member
Running this query results in the ORA-00918 : column ambiguously defined error.
Any ideas what is casing it?

SELECT
pebempl_bcat_code,pebempl_ecls_code,
ptrecls_pict_code,pdrdedn_opt_code1,
to_char(perdhis_effective_date, 'DD-MON-YYYY'),
perdhis_open_enroll_ind,
to_char(perdhis_capture_date, 'DD-MON-YYYY'),
PTRBDCA_BDTY_CODE
FROM payroll.pebempl, payroll.ptrecls,
payroll.pdrdedn,payroll.pdrdedn y , payroll.perdhis,
payroll.ptrbdca
where y.pdrdedn_pidm = spriden_pidm
and pebempl_pidm = perdhis_pidm
and perdhis_capture_date between to_date('01-JAN-2002', 'DD-MON-YYYY')
and to_date('01-FEB-2002', 'DD-MON-YYYY')
and pebempl_ecls_code = ptrecls_code
and pdrdedn_bdca_code = ptrbdca_code
and pdrdedn_bdca_code = perdhis_bdca_code
and perdhis_status = y.pdrdedn_status
and y.PDRDEDN_EFFECTIVE_DATE = (select max(x.pdrdedn_effective_date)
from pdrdedn x
where x.pdrdedn_pidm = y.pdrdedn_pidm
and x.pdrdedn_bdca_code = y.pdrdedn_bdca_code
and x.pdrdedn_status = y.pdrdedn_status)

This line is apparently causing the error:
and pdrdedn_bdca_code = perdhis_bdca_code

thank you
Re: ORA-00918 : column ambiguously defined. Please help [message #19399 is a reply to message #19398] Thu, 14 March 2002 07:59 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
One of the unqualified columns (no alias or tablename in front) appears in more than one of your tables in the FROM clause. You will need to qualify this column (tablename.column or alias.column).

Actually, it is a good idea to qualify every column in a multi-table join regardless of whether or not there are duplicate column names.
Previous Topic: Re: ROUND function
Next Topic: select distinct all
Goto Forum:
  


Current Time: Tue Apr 23 13:36:48 CDT 2024