Difference between revisions of "OE.DEPTVIEW (view)"

From dbscript Online Help
Jump to: navigation, search
(New page: == wikibot == {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- | '''view | OE.DEPTVIEW |- |} <pre> </pre>)
 
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
|-
+
|- valign="top"
| '''view
+
| '''View
 
| OE.DEPTVIEW
 
| OE.DEPTVIEW
|-
 
 
|}
 
|}
  
 +
=== Source ===
 
<pre>
 
<pre>
 
+
CREATE OR REPLACE VIEW OE.DEPTVIEW AS
 +
SELECT xmlelement("Department", xmlForest(department_name, location_id),
 +
      (SELECT sys_xmlagg(xmlelement("Employee",xmlForest(last_name,
 +
                                                          job_id,manager_id,
 +
                                                          hire_date,
 +
                                                          salary,
 +
                                                          commission_pct)
 +
                                    ), xmlformat('EmployeeList'))
 +
        FROM employees e WHERE e.department_id = d.department_id
 +
      )) xml
 +
FROM departments d
 
</pre>
 
</pre>

Latest revision as of 11:34, 27 August 2011

wikibot[edit]

View OE.DEPTVIEW

Source[edit]

CREATE OR REPLACE VIEW OE.DEPTVIEW AS 
SELECT xmlelement("Department", xmlForest(department_name, location_id),
       (SELECT sys_xmlagg(xmlelement("Employee",xmlForest(last_name,
                                                           job_id,manager_id,
                                                           hire_date,
                                                           salary,
                                                           commission_pct)
                                    ), xmlformat('EmployeeList'))
        FROM employees e WHERE e.department_id = d.department_id
       )) xml
FROM departments d