Can someone quickly spot the syntax error in this basic XML query?
592168Sep 21 2007 — edited Sep 26 2007I'm very new to SQL/XML and I'm using this query in the basic HR schema provided by Oracle in the 10g Express Edition Database.
I'm getting the "ORA-00907: missing right parenthesis" message when I run the following query, but the parenthesis all seem to match up:
SELECT
XMLELEMENT ("EMPLOYEES",
XMLAGG(XMLELEMENT ("DEPARTMENTS",
XMLELEMENT ("Department", department_name),
(SELECT
XMLELEMENT ("EMPLOYEE",
XMLAGG(XMLELEMENT ("Empno", employee_id),
XMLELEMENT ("Job", job_id),
XMLELEMENT ("FirstName", first_name),
XMLELEMENT ("LastName", last_name),
XMLELEMENT ("Email", email),
XMLELEMENT ("Phone", phone_number)))
AS result
FROM employees
WHERE employees.department_id = departments.department_id)))
AS result
FROM departments)