How to generate XML file from oracle database query result
Hi dudes,
as stated on the subject, can anyone suggests me how can i achieve the task stated above??
Here is a brief description of my problem:
I need to create a XML file once i query from the oracle database, and the query result returned from the database will be stored in XML file.
I'd searched around the JAXB, DOM, SAXP and the like basic concepts, but i still don't know how to start??
Any suggestions ???
Read this:
http://www.cafeconleche.org/books/xmljava/chapters/ch08s05.html
You might have to read more of the book to understand that chapter.
Similar Messages
-
How to export an XML file from oracle database?
plz help me its urgent requirement....could u pls tell me the step by step procedure for following questions...?how to export a data as an XML file from oracle database?
thanks in advance,
Bala.
Edited by: user3523292 on Nov 14, 2008 5:43 AMuser3523292 wrote:
plz help me its urgent requirement....could u pls tell me the step by step procedure for following questions...?how to export a data as an XML file from oracle database?
thanks in advance,
Bala.
Edited by: user3523292 on Nov 14, 2008 5:43 AMThis is a forum of volunteers. There is no "urgent" here. Nevertheless, a google search of 'xml oracle export' quickly lead me to this Oracle site:
otn.oracle.com/sample_code/tech/xml/index.html
I also see lots of hits when I search the documentation library at tahiti.oracle.com for 'xml'. This one in particular may be what you are looking for:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14252/adx_j_xsu.htm#ADXDK070 -
Export an XML file from oracle database
plz help me its urgent requirement....could u pls tell me the step by step procedure for following questions...?how to export a data as an XML file from oracle database? is it possible..?
thanks in advance,
Bala. is it possible?
Edited by: user3523292 on Nov 14, 2008 5:45 AMHere's the quick and dirty method using SQL*Plus...
SQL> select * from emp where deptno = 10;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7839 KING PRESIDENT 17-NOV-81 5000 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10
SQL> set markup html on
SQL> select * from emp where deptno = 10;
<br>
<p>
<table border='1' width='90%' align='center' summary='Script output'>
<tr>
<th scope="col">
EMPNO
</th>
<th scope="col">
ENAME
</th>
<th scope="col">
JOB
</th>
<th scope="col">
MGR
</th>
<th scope="col">
HIREDATE
</th>
<th scope="col">
SAL
</th>
<th scope="col">
COMM
</th>
<th scope="col">
DEPTNO
</th>
</tr>
<tr>
<td align="right">
7782
</td>
<td>
CLARK
</td>
<td>
MANAGER
</td>
<td align="right">
7839
</td>
<td>
09-JUN-81
</td>
<td align="right">
2450
</td>
<td align="right">
</td>
<td align="right">
10
</td>
</tr>
<tr>
<td align="right">
7839
</td>
<td>
KING
</td>
<td>
PRESIDENT
</td>
<td align="right">
</td>
<td>
17-NOV-81
</td>
<td align="right">
5000
</td>
<td align="right">
</td>
<td align="right">
10
</td>
</tr>
<tr>
<td align="right">
7934
</td>
<td>
MILLER
</td>
<td>
CLERK
</td>
<td align="right">
7782
</td>
<td>
23-JAN-82
</td>
<td align="right">
1300
</td>
<td align="right">
</td>
<td align="right">
10
</td>
</tr>
</table>
<p>
SQL>which you can spool to a file. -
How to create xml file from Oracle and sending the same xml file to an url
How to create xml file from Oracle and sending the same xml file to an url
SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way. -
How to generate XML file from SQL file !
I am new to XML publisher. I known one way to generate XML file is register one report file in concurrent manager.
But I want to generate XML file from sql file.
Could someone show me how to code in sql file, how to register is in concurrent manager.
Thanks !Hi
Phew ... not sure we have the space here. So I can point you in the right direction:
1. XML data generation - there are two packages in the db you can use with a plsql procedure, XMLGEN and SQL XML. You can also use java APIs too. Try checking the db documentation and search for the above methods.
2. Registering the report - the system administrators guide will provide this info. Hooking the program up with XMLP is covered here - http://www.oracle.com/technology/products/applications/publishing/resource/CM%20Whitepaper5.0.pdf
Regards, Tim -
How to mail pdf file from oracle database 11g
Hi,
Using following code to send pdf file from oracle database.
DECLARE
v_From VARCHAR2(80) := '[email protected]';
v_Recipient VARCHAR2(80) := '[email protected]';
v_Subject VARCHAR2(80) := 'test subject';
v_Mail_Host VARCHAR2(30) := '116.214.31.249';
v_Mail_Conn sys.utl_smtp.Connection;
crlf VARCHAR2(2) := chr(13)||chr(10);
BEGIN
v_Mail_Conn := sys.utl_smtp.Open_Connection(v_Mail_Host, 26);
sys.utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
sys.utl_smtp.Mail(v_Mail_Conn, v_From);
sys.utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
sys.utl_smtp.Data(v_Mail_Conn,
'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
'From: ' || v_From || crlf ||
'Subject: '|| v_Subject || crlf ||
'To: ' || v_Recipient || crlf ||
'MIME-Version: 1.0'|| crlf || -- Use MIME mail standard
'Content-Type: multipart/mixed;'|| crlf ||
' boundary="-----SECBOUND"'|| crlf ||
crlf ||
'-------SECBOUND'|| crlf ||
'Content-Type: text/plain;'|| crlf ||
'Content-Transfer_Encoding: 7bit'|| crlf ||
crlf ||
'some message text'|| crlf || -- Message body
'more message text'|| crlf ||
crlf ||
'-------SECBOUND'|| crlf ||
'Content-Type: file;'|| crlf ||
' name="D:\mail\pdfSample.pdf"'|| crlf ||
'Content-Transfer_Encoding: 8bit'|| crlf ||
'Content-Disposition: attachment;'|| crlf ||
' filename="D:\mail\pdfSample.pdf"'|| crlf ||
crlf ||
'CSV,file,attachement'|| crlf || -- Content of attachment
crlf ||
'-------SECBOUND--' -- End MIME mail
sys.utl_smtp.Quit(v_mail_conn);
EXCEPTION
WHEN sys.utl_smtp.Transient_Error OR sys.utl_smtp.Permanent_Error then
raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
END;
Above code executed successfully and mail is send to recipient but file is corrupted.
I think it doesn't pick file from specified location, attachment name is appearing like this 'D:mailpdfsample.pdf
Oracle Database : 11g R2
O.S : windows 7 Professional
Thanks in Advanceparapr wrote:
sys.utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);The above violates RFC 5321 section 4.1.1.1
'-------SECBOUND'|| crlf ||
'Content-Type: file;'|| crlf ||
' name="D:\mail\pdfSample.pdf"'|| crlf ||
'Content-Transfer_Encoding: 8bit'|| crlf ||
'Content-Disposition: attachment;'|| crlf ||
' filename="D:\mail\pdfSample.pdf"'|| crlf ||Invalid Mime header above. Filename are logical. Not physical. Loose the drive and directory names. The filename is there to name the Mime body's content.
crlf ||
'CSV,file,attachement'|| crlf || -- Content of attachmentHow is the above PDF content? This is a string containing the text CSV,file,attachement. Which means when this is what is saved as a PDF file by the mail reader.
EXCEPTION
WHEN sys.utl_smtp.Transient_Error OR sys.utl_smtp.Permanent_Error then
raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
END;Silly. Why change meaningful exceptions into a generic meaningless exception?? That does not make any sense. -
How to generate MT files from Oracle EBS Payables
Hi, does anyone has experience in generating MT files from Oracle Payables?
All contributions are welcome...Hi,
are you talking about MT-940 format files? If so, what is the use case behind this issue?
I created a custom loader process to upload MT-940 bank statements into Cash Management
some time ago, but as far as i understood your question, you want to create those files based
on payables data?
Regards -
Best Practices:: How to generate XML file from a ResultSet
Hi all,
Could someone please suggest the best practices of how to generate an XML file from a resultset? I am developing a web application in Java with Oracle database and one of my tasks is to generate an XML file when the user, for example, click a "download as XML" button on the JSP. The application is basically like an Order with line items. I am using Struts and my first thought has been to have an action class which will extend struts's DownloadAction and through StAX's Iterator API to create an XML file. I intend to have a POJO which will have properties of all columns of my order and line items tables so that for each order I get all line items and:
1. Write order details then
2. Through an iterator write line items of that order to an XML file.
I will greatly appreciate for comments or suggestions on the best way to do this through any pointers on the Web.
alexUse a OracleWebRowSet in which an XML representation of the result set may be obtained.
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/oracle10g/webrowset/Readme.html
http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/jcrowset.htm -
Generate .dbf file from oracle database using JDBC
Dear all,
I need to generate a .dbf file from oracle table. Anyone know how to do this using Java Programming or JDBC? please help!
thank youHi,
I assume you already have a JDBC driver for either FoxPro or DBase. If not, use the JDBC-ODBC bridge and the ODBC driver that comes with Window$.
When you issue a "Create TABLE" command the driver will automatically create a .dbf file and then you can export data to it.
Imran -
How to Generate XML File from Java Code.
I want to generate the xml file from the java code.
Could you plz suggest any webSite address with example?Here is the code
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class CreateXML {
private DocumentBuilderFactory factory = null;
private DocumentBuilder builder = null;
private Document document = null;
public CreateXML() {
try {
factory = DocumentBuilderFactory.newInstance();
builder = factory.newDocumentBuilder();
document = builder.newDocument();
} catch (FactoryConfigurationError e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
/** Creates the document for xml. */
public Document createDocument(){
try{
Element root = document.createElement("Root");
Element child = document.createElement("child");
root.appendChild(child);
document.appendChild(root);
}catch(RuntimeException e){
e.printStackTrace();
return document;
/** Saves the document as xml. */
public void saveDocument(Document document){
try{
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();
DOMSource source = new DOMSource(document);
StreamResult stream = new StreamResult(new File("sample.xml"));
transformer.transform(source, stream);
System.out.println("XML Created !!");
}catch(TransformerConfigurationException e){
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
public static void main(String args[]){
CreateXML createXML = new CreateXML();
Document document = createXML.createDocument();
createXML.saveDocument(document);
} -
Generate XML Schema from Oracle Database
Is there a utility that would allow our team to generate XML Schemas directly from existing Oracle databases? Or do you have a suggestion on how to achieve this?
Thank you.Hey, The Schema Processor is available in the Technologies section on this site. Just download it and see the samples. You will get the way for doing it. If you are having problems then just call me.
Bye.
null -
How to generate xml file from an array of data using jQuery
Hi All,
Iam facing the problem with diaplaying array of data into a xml file, Actually iam using SAPUI5 commons table to display the backend data, each row in the table has checkbox. If we select each checkbox, iam getting the particular record and push it into an empty array and then i should show that array of data into xml file.OData.request
requestUri: url,
method: "POST",
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"Accept": "application/atom+xml,application/atomsvc+xml,application/xml",
"X-CSRF-Token": header_xcsrf_token
data: requestTableDATAArray
// Response after posting and set message
function (data, response)
alert(response.body);//gives xml format -
.xml files from Oracle database
Hi all,
Just need bit of Info about, Interface to other systems with an Oracle application:
Currently we have Interface with ABC application. We create a .txt file every night through a batch job about 7.30 pm and that .txt file FTP's to the ABC system. That ABC system update their tables with that .txt file and genrate and another .txt file and FTP's to us about 9 pm every weekday then it updates out tables.
Now the ABC system changing their system to web based system and want to change file type from .txt to .xml
I have just started reading about XML but like to know if we create a file with the extention of .xml instead if .txt is that going to work.
and the file we receive every day about 9 ish is changing to .xml as well, so what changes do we have to make in our database for this
I know this seems to me a vague question, but any help would be appreciated.Hi,
this seems to be a database releated question and is better asked on the database forum.
Frank -
How to generate XML file from a table without using UTL_FILE that too in local machine...
You downloaded the wrong XML Parser!
XSQL requires Java Parser. Well, there's a copy included with the XSQL package so you actually don't need to do another download.
You really don't need XSQL if you just want a XML file from DB, you just needed a XML SQL Utility. Download that and run the samples. -
How to generate .SQL format file from oracle database?
How to generate .SQL format file from oracle database?
I have a database of Oracle 8.1.6,now want to generate script file (including table structure,index,etc.) from it,What should I do?
Thanks.Your question pertains to the Database Export/Import. This forum exclusively focusses on the export/import utilities that come along with "Oracle Portal" which is a web-based tool. Could you please post your question under the RDBMS export/import or migration forum.
Maybe you are looking for
-
Ipod shuffle not recognized by windows XP and Itunes.
I had no problems when i synced my ipod before, but sudenly stoped working! Nothing changed in my computer... Everytime I conect my ipod to my computer, the orange light starts blinking and windows doesnt recognize it. I ve tried diferent ports and n
-
How can I check the version of my Airport Express and TimeCapsule machines ?
I want to look up the technical specifications of the routers in my wifi network (1 TimeCapsule and 3 Airport Expresses), such as maximum bandwidth etc. (my provider just increased maximum download speed but I am not seeing that difference on my mach
-
I have itunes credit card and scrached off the # and cant see it how do i redeem now?
I have a itunes credit card I scrached the # off and cant see it how do I redeem it now?
-
Navigation problem, please help
This is what I have. A DSP 4 project with only one main menu. This menu has two buttons. "button one" plays "movie one" and "Button two" plays "movie two". "movie one" and "movie two" are stories from one video track. The end jump of each story is ba
-
MAX differential measurement does not match DAQ Assistant output
I am using a USB Compact DAQ AI 9205 and have a differential input running into AI23 and AI31.The signal is run to the AI module with a shielded twisted pair cable. When using MAX, it shows that my signal is at about 4.4 Vdc. An external meter agree