People that know SQL - Help please!
I am writing a query in this SQL program for my class and I keep getting this error:
ORA-00918: column ambiguously defined
Although I know you can't really test it, here is the code:
Apparently, the problem is in my select statement. But the error is supposed to mean that there are two columns with the same name in two different tables that I am trying to access. The resolution says to prefix the column names with their respective table names which I did and I still can't get it to work. Any ideas?
ORA-00918: column ambiguously defined
Although I know you can't really test it, here is the code:
Code:
-- program: U403.sql
-- author: Peter Nagy ciss-250 Fall 07
-- date: 10-2-2007
-- purpose: Prompt user for pilot license type and return pilot information.
TTITLE 'RobAir - Pilot Info Based on License Type Entry'
ACCEPT my_pilot_license_type CHAR PROMPT 'Enter Pilot License Type (COM or ATP): '
COLUMN pil_pt135_date -
HEADING 'Proficiency Test Date'
COLUMN emp_hire_date -
HEADING 'Hire Date'
SELECT (employee.emp_fname ||' '|| employee.emp_lname) Pilot,
pilot.pil_pt135_date,
employee.emp_hire_date
FROM hartmar.employee, hartmar.pilot
JOIN hartmar.pilot ON employee.emp_num = pilot.emp_num
WHERE pilot.pil_license = '&my_pilot_license_type'
ORDER BY Pilot
;
Try this. Not sure if it'll work but it's worth a shot.
Code:
SELECT (e.emp_fname ||' '|| e.emp_lname) Pilot, p.pil_pt135_date, e.emp_hire_date FROM hartmar.employee e, hartmar.pilot p JOIN hartmar.pilot ON e.emp_num = p.emp_num WHERE p.pil_license = '&my_pilot_license_type' ORDER BY Pilot;
Yes.
Don't know if you guys can see it, but here is the database structure:
Last edited by Pete; Oct 2, 2007 at 09:47 AM.


