How to write the oracle data as XML format. (.XML file)
create or replace procedure pro(p_number )
is
cursor c1 is select *from emp where empno=p_number;
v_file utl_file.file_type;
begin
v_file := utl_file.fopen('dirc','filename.txt','w');
for i in c1 loop
utl_file.put_line(v_file,i.ename || i.empno ||i.job);
end loop;
closef(v_file);
end;
Now my client want instead of .txt file he need .xml files
File should contains xml tags. can any one help regarding this.. with one example.
How to write the oracle data as XML format. (.XML file)
hi,
hope this example will do something....
SQL> select employee_id, first_name, last_name, phone_number
2 from employees where rownum < 6
EMPLOYEE_ID FIRST_NAME LAST_NAME PHONE_NUMBER
100 Steven King 515.123.4567
101 Neena Kochhar 515.123.4568
102 Lex De Haan 515.123.4569
103 Alexander Hunold 590.423.4567
104 Bruce Ernst 590.423.4568
SQL> select dbms_xmlgen.getxml('select employee_id, first_name,
2 last_name, phone_number from employees where rownum < 6') xml
3 from dual;
*<?xml version="1.0"?>*
*<ROWSET>*
*<ROW>*
*<EMPLOYEE_ID>100</EMPLOYEE_ID>*
*<FIRST_NAME>Steven</FIRST_NAME>*
*<LAST_NAME>King</LAST_NAME>*
*<PHONE_NUMBER>515.123.4567</PHONE_NUMBER>*
*</ROW>*
*<ROW>*
*<EMPLOYEE_ID>101</EMPLOYEE_ID>*
*<FIRST_NAME>Neena</FIRST_NAME>*
*<LAST_NAME>Kochhar</LAST_NAME>*
*<PHONE_NUMBER>515.123.4568</PHONE_NUMBER>*
*</ROW>*
*<ROW>*
*<EMPLOYEE_ID>102</EMPLOYEE_ID>*
*<FIRST_NAME>Lex</FIRST_NAME>*
*<LAST_NAME>De Haan</LAST_NAME>*
*<PHONE_NUMBER>515.123.4569</PHONE_NUMBER>*
*</ROW>*
*<ROW>*
*<EMPLOYEE_ID>103</EMPLOYEE_ID>*
*<FIRST_NAME>Alexander</FIRST_NAME>*
*<LAST_NAME>Hunold</LAST_NAME>*
*<PHONE_NUMBER>590.423.4567</PHONE_NUMBER>*
*</ROW>*
*<ROW>*
*<EMPLOYEE_ID>104</EMPLOYEE_ID>*
*<FIRST_NAME>Bruce</FIRST_NAME>*
*<LAST_NAME>Ernst</LAST_NAME>*
*<PHONE_NUMBER>590.423.4568</PHONE_NUMBER>*
*</ROW>*
*</ROWSET>*
ask if you want more assistance.
thanks.
Similar Messages
-
Can any one please tell me how to configure the oracle data gaurd. in steps
can any one please tell me how to configure the oracle data gaurd. in steps
Hi,
http://docs.oracle.com/cd/E11882_01/server.112/e25608/create_ps.htm#i63561
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r2/prod/ha/dataguard/physstby/physstdby.htm
Regards
Yoonas -
How to download the Dynamic data into PPT format
Hi Friends,
I have one doubt on WDJ. How to download the Dynamic data into PPT format. For Example Some Dynamic data is available in to View in that One Download Link or button available. Click on Download link or button download that data into PPT Format
Is it possible for WDJ. If possible please tell me.
Or
How to create Business Graphics in Web Dynpro Applications depening up on Excel Data and finally we can download the Business Graphics into powerpoint presentation.
Thank you,
Regards
Vijay Kalluri
Edited by: KalluriVijay on Mar 11, 2011 6:34 AMHi Govindu,
1. I have one doubt on WDJ. Click on either Submit Buttion or LinkToURL UI we can download the file that file having ppt formate(Text.PPT).
I am using NWDS Version: 7.0.09 and Java Version: JDK 1.6
2. is it possible to download the business Graphics in to the PPT by using Java DynPro
Regards
VijayK -
How to write the output of a mapping into a file (OWB10.2
Hi
I am using Oracle 10.2.0.1 version of OWB.
the task is to write the output of a mapping into a File (Flat File).
Please help me out!
Regards
AbiHi,
Create the file format thru OWB and mention the location in OWB. Deploy the file and it will be ready to use for target load. Make sure the connection to the target loc is available.
Regards
Bharadwaj Hari -
How to write the table content of JSP to a file
Hi there,
i have a JSP which displays data in table format.
i need to copy the data of the table( columns with comma separated and rows with line breaks).
on Mouse click of an hyper link or Button i need to perform the above action.
as i found java script wont support writing files to hard drive, i expecting help from you guys
for the solution.
Thanks and regards
RLoveOpensource wrote:
Hi thanks for your reply
i am using struts
and
i am displaying the table using
<logic:iterate can you please tell me how to implement your method on my code
my complete code for generating the table is
<table id="tbl" border="1" cellspacing="0" cellpadding="0">
<tr>
<td><h4>LPCDealName</h4></td>
<td><h4>IntexDealName</h4></td>
</tr>
<logic:iterate id="rows" property="table" indexId="rowCount" name="LPCIntexActionForm">
<tr >
<logic:iterate id="row" indexId="colCount" name="rows" length="2">
<td><bean:write name="row" /></td>
</logic:iterate>
<td><a href="">Modify the Mapping</a></td>
</tr>
</logic:iterate>
</table>
<% File log = CreateLog(); %>
//this one for calling method
//this one for printing data in log file
<% p.println(LPCDealName);
p.println(IntexDealName); %> -
How to write the contents of string buffer to a file
hi all
how is it possible to write the contents of a string buffer to a new file (ie i have to create a file and write in it )
this my string buffer
StringBuffer s=new StringBuffer();
s.append("<html><head><title>Welcome</title>");
s.append("</head>");
s.append("<body>");
s.append("<b> Hello,");
s.append(output);
s.append(" You have been Sucessfully authenticated</b>");
s.append("</body></html>");
so please can anyone help mefor nice examples of how to do things you may look int [url http://javaalmanac.com]Java Almanac
or more specifficly: [url http://javaalmanac.com/egs/java.io/WriteToFile.html?l=find]Writin to a File
in case you don't know how to apply that example on your code, since you have StringBuffer instead of String, then look at [url http://java.sun.com/j2se/1.4.2/docs/api/]API Specification of [url http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html]StringBuffer, and see if there is some method like toString() or similar, that would help you convert your StringBuffer to a String. -
How to get the last data point from a TDM file in LabVIEW?
Hello,
I am using LabVIEW to analyze some rather large TDM files, and I need a way to get only the last data point. So far, the only way I have been able to accomplish this is by reading the entire file. Is there a property in the TDM file or a function in LabVIEW that will allow me to get the index of the last item in a channel?
Thanks!
ChristinaDo you want to avoid reading whole file and want to be able to reach or get the index of last value of channel? is there any specific reason? I am not sure you could do it without loading the whole file. But the easiest way would be just to use array functions "array size" would give you the index of last element.
-Nilesh
Kudos are (always) welcome for the good post. :-) -
How to conver the oracle data into xml files
Hi All,
I have a table for ex emp, now i want to generate every row into an xml file. could anyone pls help...
ex:- emp table
eno ename sal
1 bond 3000
2 kiran 2000
3 jai 1000
4 henry 500
o/p :- i have to get a column in 4 different files for this 4 rows.
1.xml file should contain data <ID>1</ID><eNAME>bond</eNAME><sal>3000</sal>
2.xml file should contain data <ID>2</ID><eNAME>kiran</eNAME><sal>2000</sal>
3.xml file should contain data <ID>3</ID><eNAME>jai</eNAME><sal>1000</sal>
4.xml file should contain data <ID>1</ID><eNAME>bond</eNAME><sal>500</sal>
regards,
Badri.You can do it like this :
begin
for r in (
select empno
, xmlserialize(content xmlforest(empno as "ID", ename, sal)) as xmlcontent
from scott.emp
loop
dbms_xslprocessor.clob2file(r.xmlcontent, 'TEST_DIR', to_char(r.empno) || '.xml');
end loop;
end; -
How to get the Oracle Data Mining
Hi
I downloaded Oracle Database 10g r2 on Oracle's download website, and I want the ODM, but it is said in the white paper that ODM is a priced option. I'd like to know how to get it.Data Mining is a priced option shipped with Oracle Enterprise Edition. You can get Data Mining option by installing Oracle 10gR2 and select 'general purpose' with the pre-configured database. Data Mining option is installed as default in that choice.
If for production purposes, customers do need to purchase Data Mining option lisence through Oracle sales.
Xiafang -
How to download the report data in xml format
Hi All,
how to download the report data (sql/interactive) in xml format...
Thanks,
VinothYou will want to do something like this:
http://spendolini.blogspot.com/2006/04/custom-export-to-csv.html
except customize it for xml.
hth,
John -
How to edit the existing data in the XML file from java programming.
Hi all
i am able to create XML file with the sample data as below from java programming.
i need sample code on how to edit the existing data in the XML file?
for example
<?xml version="1.0"?>
<mydata>
<data1>
<key1>467</key1>
<name1>Paul</name1>
<id1>123</id1>
</data1>
<data2>
<key2>467</key2>
<name2>Paul</name2>
<id2>123</id2>
</data2>
</mydata>
i am able to insert the data in the XML.
now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
Regards
Sunil
[points will be always rewardable]hi
u need a parser or validate the xml file for to read the xml file from java coding u need for this
xml4j.jar u can download this file from here
http://www.alphaworks.ibm.com/tech/xml4j
or we can use the SAX(simple API for XML)
some sample applications for this
http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
http://www.xml-training-guide.com/e-xml44.html
let me know u need any other info
bvr -
How to populate the Quering data into Excel sheet in Oracle
Dear Guys,
How to populate the Quering data into Excel sheet in oracle.
Please provide a solution.
Thanks & Regards,
Senthil K KumarHi
To make Excel sheets from sqlplus, you can use the markup html tag in sqlplus.
Here's an example.
Example
<code>
SET LINESIZE 4000
SET VERIFY OFF
SET FEEDBACK OFF
SET PAGESIZE 999
SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
SPOOL c:\test_xls.xls
SELECT object_type
, SUBSTR( object_name, 1, 30 ) object
, created
, last_ddl_time
, status
FROM user_objects
ORDER BY 1, 2
SPOOL OFF
SET MARKUP HTML OFF ENTMAP OFF SPOOL OFF PREFORMAT ON
SET LINESIZE 2000 VERIFY ON FEEDBACK ON
</code> -
How to write the nodevalue back to xml file?
Hi, Everybody:
These are two packages I used. javax.xml.parsers.*,org.w3c.dom.*
Now I use "setNodeValue("abc") to set the node value to "abc". But it is not really saved back into XML file. It only change the node value in memory.
How to write the changes back to XML file? Thank you very much for your help.
Michelle* Version : 1.00
* File Purpose : Given the xml file loads into dom and recreate the file with the updated values.
* Developer : Kashif Qasim : 25/july/04
* Modify detail :
import java.lang.*;
import java.io.*;
import java.util.*;
import java.text.*;
import org.w3c.dom.*;
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.*;
public class XMLWriter
private String displayStrings[] = new String[5000];
private int numberDisplayLines = 0;
private Document document;
//private final Node c;
public synchronized void displayDocument(String uri,Vector UpdatedValues,String getTaskID)
try {
DOMParser parser = new DOMParser();
parser.parse(uri);
document = parser.getDocument();
display(document, "",UpdatedValues);
} catch (Exception e) {
e.printStackTrace(System.err);
ReadXmlConfig objReadXmlConfig = null;
FileWriter filewriter = null;
try {
filewriter = new FileWriter(uri);
for(int loopIndex = 0; loopIndex < numberDisplayLines; loopIndex++){
filewriter.write(displayStrings[loopIndex].toCharArray());
//System.out.println("displayStrings[loopIndex].toCharArray() "+displayStrings[loopIndex].toString());
//filewriter.write("\n");
filewriter.close();
System.gc();
objReadXmlConfig = new ReadXmlConfig();
objReadXmlConfig.ITSLog("File updated for "+getTaskID+" succesfully, file is closed now ");
} catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage());
objReadXmlConfig = new ReadXmlConfig();
objReadXmlConfig.ITSErrorLog("File updated FAILED for "+getTaskID+". Reason for file error "+e.toString());
}finally {
if (filewriter != null) {
System.out.println("Closing File");
objReadXmlConfig =null;
try{
filewriter.close();
}catch(IOException e){
System.err.println("Caught IOException: " + e.getMessage());
} else {
System.out.println("File not open");
private void display(Node node, String indent, Vector UpdtRecs)
if (node == null) {
return;
int type = node.getNodeType();
NodeList nodeList = document.getElementsByTagName("QueryParm");
int TotalRecs = UpdtRecs.size();
switch (type) {
case Node.DOCUMENT_NODE: {
displayStrings[numberDisplayLines] = indent;
displayStrings[numberDisplayLines] +=
"<?xml version=\"1.0\" encoding=\""+
"UTF-8" + "\"?>";
numberDisplayLines++;
displayStrings[numberDisplayLines] += "\n";
display(((Document)node).getDocumentElement(), "",UpdtRecs);
break;
case Node.ELEMENT_NODE: {
if(node.getNodeName().equals("QueryParm")) {
for(int i =0 ; i< nodeList.getLength() ; i++)
Node nodeQry = nodeList.item(i);
NamedNodeMap nnp = nodeQry.getAttributes();
for(int j= 0 ; j < nnp.getLength() ; j++)
Attr atr = (Attr) nnp.item(j);
if(atr.getName().equalsIgnoreCase("value_"+(i+1)))
//System.out.println(atr.getName() +" : " + atr.getNodeValue() );
atr.setNodeValue(UpdtRecs.get(i).toString());
displayStrings[numberDisplayLines] = indent;
displayStrings[numberDisplayLines] += "<";
displayStrings[numberDisplayLines] += node.getNodeName();
int length = (node.getAttributes() != null) ?
node.getAttributes().getLength() : 0;
Attr attributes[] = new Attr[length];
for (int loopIndex = 0; loopIndex < length; loopIndex++) {
attributes[loopIndex] = (Attr)node.getAttributes().item(loopIndex);
for (int loopIndex = 0; loopIndex < attributes.length; loopIndex++) {
Attr attribute = attributes[loopIndex];
displayStrings[numberDisplayLines] += " ";
displayStrings[numberDisplayLines] += attribute.getNodeName();
displayStrings[numberDisplayLines] += "=\"";
displayStrings[numberDisplayLines] += attribute.getNodeValue();
displayStrings[numberDisplayLines] += "\"";
displayStrings[numberDisplayLines]+=">";
numberDisplayLines++;
NodeList childNodes = node.getChildNodes();
if (childNodes != null) {
length = childNodes.getLength();
indent += " ";
for (int loopIndex = 0; loopIndex < length; loopIndex++ ) {
display(childNodes.item(loopIndex), indent,UpdtRecs);
break;
case Node.CDATA_SECTION_NODE: {
displayStrings[numberDisplayLines] = "";
displayStrings[numberDisplayLines] += "<![CDATA[";
displayStrings[numberDisplayLines] += node.getNodeValue();
displayStrings[numberDisplayLines] += "]]>";
numberDisplayLines++;
break;
case Node.TEXT_NODE: {
displayStrings[numberDisplayLines] = "";
String newText = node.getNodeValue().trim();
if(newText.indexOf("\n") < 0 && newText.length() > 0) {
displayStrings[numberDisplayLines] += newText;
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
break;
case Node.PROCESSING_INSTRUCTION_NODE: {
displayStrings[numberDisplayLines] = "";
displayStrings[numberDisplayLines] += "<?";
displayStrings[numberDisplayLines] += node.getNodeName();
String text = node.getNodeValue();
if (text != null && text.length() > 0) {
displayStrings[numberDisplayLines] += text;
displayStrings[numberDisplayLines] += "?>";
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
break;
if (type == Node.ELEMENT_NODE) {
displayStrings[numberDisplayLines] = indent.substring(0,
indent.length() - 4);
displayStrings[numberDisplayLines] += "</";
displayStrings[numberDisplayLines] += node.getNodeName();
displayStrings[numberDisplayLines] += ">";
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
indent += " ";
public static void main(String args[])
Vector xmlValue = new Vector();
xmlValue.add(0,"Kashif");
xmlValue.add(1,"Qasim");
//displayDocument("NewMediation.xml",xmlValue);
<?xml version="1.0" encoding="UTF-8"?>
<Mediation>
<Task1>
<Source>
<SourceDriver>com.microsoft.jdbc.sqlserver.SQLServerDriver</SourceDriver>
<SourceConnection>jdbc:microsoft:sqlserver://10.2.1.58:1433;DatabaseName=MTCVB_HDS;</SourceConnection>
<SourceUser>sa</SourceUser>
<SourcePassword>sa</SourcePassword>
<Table>
<SourceTable>t_Agent</SourceTable>
<SourceQuery><![CDATA[SELECT SkillTargetID,PersonID,PeripheralID,EnterpriseName,PeripheralNumber,Deleted,TemporaryAgent,AgentStateTrace,ChangeStamp FROM t_Agent where SkillTargetID > {value_1} order by SkillTargetID]]>
</SourceQuery>
<SourceParm BusinessRule="" ColumnName="SKILLTARGETID" ColumnNumber="1" DataType="Numeric" DefaultValue="0" Format="mm/dd/yyyy xx:xx:xx XX">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERSONID" ColumnNumber="2" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERIPHERALID" ColumnNumber="3" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="ENTERPRISENAME" ColumnNumber="4" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERIPHERALNUMBER" ColumnNumber="5" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="DELETED" ColumnNumber="6" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="TEMPORARYAGENT" ColumnNumber="7" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="AGENTSTATETRACE" ColumnNumber="8" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="CHANGESTAMP" ColumnNumber="9" DataType="String" DefaultValue="" Format="">
</SourceParm>
<QueryParm FldName_1="SkillTargetID" FldType_1="Number" value_1="0">
</QueryParm>
</Table>
</Source>
</Task1>
</Mediation>
The QueryParm values are updated thru this code :)
Hope it helps u ... -
How to write the data into EEPROM using Labview?
How to write the data into EEPROM using Labview?
You would need some sort of EEPROM programmer. Typically might
communicate with it via serial. I don't know how you would do this in
LV. You would need to have the command protocol for the programming
device to start with.
Doug De Clue
gpibssx wrote in message news:<[email protected]>...
> How to write the data into EEPROM using Labview? -
How to write the java program to retrieve the last 7 days dates
Hi,
I am having requirement that how to write the java program to retrieve the last 7 days dates. Please help me.
Regards,
AhamadIt needs any jar file.Of course!
I did using jscape.My program is running fine.But it
requires jar file.Which is licensed version.Maybe you should follow the link the the 'license' on the site I posted!
>
I have the doubt is apache provides jar file free
versionMaybe you should follow the link the the 'license' on the site I posted!
Maybe you are looking for
-
How read word document in form from server's filesystem?
I want develope an application using client/server framework: In server's filesystem hold a variety of files,for example, .doc,.xls,.pdf,information about these files(for example,file type,file name,file summary) hold in a table,as well as file point
-
How to freeze the entry in screen painter?
Hi Friends i am facing one problem with my task like i am having one field called EMPID as text name and name of the INPUT/OUTPUT field is ZCOMPANY-EMPID in screen number 100. And the same field is copied to another screen of number 200. Here my requ
-
How do I get a refund on a bad app
Bought an App today for my iPhone and it doesn't do what I bought it for. Seems the description implied a feature that doesn't actually exist. Anyone know how to get a refund from the App Store on a bad App?
-
System Preferences hangs with Mountain Lion
Various parts of system preferences hang under Mountain Lion. Prior to upgrade there was no problem. Any ideas?
-
The battery of my two months old iPad2 is not charging anymore. Somebody knows what is going on?