declare
queryCtx DBMS_XMLquery.ctxType;
result CLOB;
begin
-- set up the query context...!
queryCtx := DBMS_XMLQuery.newContext('select * from emp');
-- get the result..!
result := DBMS_XMLQuery.getXML(queryCtx);
-- Now you can use the result to put it in tables/send as messages..
printClobOut(result);
DBMS_XMLQuery.closeContext(queryCtx); -- you must close the query handle..
end;
/
The printClobOut procedure is :
/CREATE OR REPLACE PROCEDURE printClobOut(result IN OUT NOCOPY CLOB) is
xmlstr varchar2(32767);
line varchar2(2000);
begin
xmlstr := dbms_lob.SUBSTR(result,32767);
loop
exit when xmlstr is null;
line := substr(xmlstr,1,instr(xmlstr,chr(10))-1);
dbms_output.put_line('| '||line);
xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
end loop;
end;
/
Hope that helps,
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of rahul sharma
Sent: Monday, July 28, 2003 10:51 AM
To: Multiple recipients of list ORACLE-L
Subject: a simple xml output using stylsheetdear list, can anyone please point me to a simple example of select * from emp; queryand the output displayed in xml (using a simple stylesheet) ...we have not been able to locate this on the net...TIA-Rahul----------------------------------------------------------------------------------------------------------------------------------------------------------------
The information contained in this email and its attachments if any may contain privileged and confidential information
intended only for the attention of the recipient(s) specified. If you are not a recipient , any forwarding , disclosure ,
photocopying , distribution or use of the information in any way is prohibited . If you have received this email in error ,
please email us immediately on [EMAIL PROTECTED] or contact us on (62 21) 522 8775.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
