Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ambiguous Column within Sub Select Query

750523Feb 17 2010 — edited Feb 17 2010
I am getting an 'ambiguous column' error when I query using a sub select. Here is my query:

select *
from (select
c.custody_id,
c.person_id,
n.first_name,
n.last_name,
z.usms_number,
c.start_date,
c.end_date,
c.district_office_id,
cbc.custody_id,
c.update_date,
c.update_user_id
from custody c,
custody_booking_pkg_components cbc,
z_migrate_usms_number z,
district_office do,
district d,
person p,
name n
where
c.person_id = p.person_id and
z.person_id = p.person_id and
z.ordinal = 1 and
c.custody_id = cbc.custody_id(+) and
p.name_id = n.name_id and
do.district_id = d.district_id and
c.district_office_id = do.district_office_id and
d.district_id = 99 order by c.update_date desc)
where rownum <= 10;

I understand why a 'ambiguous column' error means, but I dont see which column is ambiguous. I have ran the sub select by itself and it works correctly, but when combined with the outer select it fails.
This post has been answered by Frank Kulash on Feb 17 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2010
Added on Feb 17 2010
3 comments
3,491 views