dbTalk Databases Forums  

Generating XML document from table containing Nested table

comp.database.oracle comp.database.oracle


Discuss Generating XML document from table containing Nested table in the comp.database.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
iota1234 (Offline)
Junior Member
 
Posts: 1
Join Date: May 2006

Default Generating XML document from table containing Nested table - 05-11-2006 , 09:26 AM






Hi,
I am an XML newbie. I am trying to retrieve data , in the form of XML from a table that has a nested table.

My table structure is as follows :-
CREATE OR REPLACE
TYPE Course AS OBJECT (
course_no NUMBER(4),
title VARCHAR2(35),
credits NUMBER(1))
/

CREATE OR REPLACE
TYPE CourseList AS TABLE OF Course
/
CREATE TABLE DEPARTMENT
(
NAME VARCHAR2(20 BYTE),
DIRECTOR VARCHAR2(20 BYTE),
OFFICE VARCHAR2(20 BYTE),
COURSES COURSELIST
)
NESTED TABLE COURSES STORE AS COURSES_TAB;

SQL> desc department
Name Null? Type
----------------------------------------- -------- ----------------------------
NAME VARCHAR2(20)
DIRECTOR VARCHAR2(20)
OFFICE VARCHAR2(20)
COURSES COURSELIST


I am issuing the following command in Oracle 10g, but I am getting an error .

SELECT XMLForest(department(d.dname,d.director, d.office,
CAST(MULTISET(
select e.course_no, e.title "Course_title"
from table(d.courses) e
where e.deptno = d.deptno) AS "test")) AS "Department")
AS deptxml
FROM department d;

ERROR at line 5:
ORA-00902: invalid datatype

I would really appreciate any help. Thanks in advance.
S

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.