Thanks Friend, a little more edit. I have data in a table type, Oracle 11g PLSQL. inside that table type another table type , and inside another table type for example
header_table_type has
columns header_id (Number)
item_name (varchar2)
item_type (varchar2)
service_detail **(Service_table_type)**
service_table_type has
columns service_name (Varchar2),
service_id (varchar2)
service_details **(service_term_table_type)**
service_term_table_type has
service_1 varchar2,
service_2 varchar2 ,
service 2 varchar2.
My table_type has the structure as above mentioned . Is there any way to make this table_type into an XML format. for sending through a Web service. Please help
Of course this is possible by using function
XMLTYPE()
Try this example
create type service_term_table_type as object (
service_1 varchar2(30),
service_2 varchar2(30),
service_3 varchar2(30)
)
/
create type service_table_type as object (
service_id varchar2(30),
service_details service_term_table_type
)
/
create type header_table_type as object (
header_id number,
item_name varchar2(30),
item_type varchar2(30),
service_detail service_table_type)
/
create table xml_example (a xmltype)
/
declare
mytype header_table_type:=header_table_type(1,'a','b',service_table_type('c',service_t erm_table_type('d','e','f')));
x xmltype;
begin
x:=xmltype(mytype);
insert into xml_example values (x);
end;
Now you can see the result:
select substr(a,1,500) from xml_example;
<HEADER_TABLE_TYPE>
<HEADER_ID>1</HEADER_ID>
<tITEM_NAME>a</ITEM_NAME>
<ITEM_TYPE>b</ITEM_TYPE>
<SERVICE_DETAIL>
<SERVICE_ID>c</SERVICE_ID>
<SERVICE_DETAILS>
<SERVICE_1>d</SERVICE_1>
<SERVICE_2>e</SERVICE_2>
<SERVICE_3>f</SERVICE_3>
</SERVICE_DETAILS>
</SERVICE_DETAIL>
</HEADER_TABLE_TYPE>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.