Exporting data from database tables to a XML file
Hi,
We want to export data from Oracle database tables to an XML
file. What tool can we use for this purpose, and how do we go
about it ?
Can we extract data only from an Oracle8 database, or can we
extract data from Oracle7.3 databases too ?
Any help in this regard would be appreciated.
Thanks
Dipanjan
null
Dipanjan (guest) wrote:
: Hi,
: We want to export data from Oracle database tables to an XML
: file. What tool can we use for this purpose, and how do we go
: about it ?
: Can we extract data only from an Oracle8 database, or can we
: extract data from Oracle7.3 databases too ?
: Any help in this regard would be appreciated.
: Thanks
: Dipanjan
Start by downloading the XML SQL Utility and make sure you have
the approriate JDBC 1.1 drivers installed for your database.
There are samples which will get you going included in the
archive.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null
Similar Messages
-
Inserting data from a table to an XML file
I want to insert the values from this xml file emp.xml into a table Employees :
<EMPLOYEES>
<EMP>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<HIREDATE>17-DEC-80</HIREDATE>
<SAL>800</SAL>
</EMP>
<EMP>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<HIREDATE>20-FEB-81</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
</EMP>
<EMP>
</EMPLOYEES>
and here is my Employee table in Oracle 9i database
SQL> DESC EMPLOYEE;
Name Null? Type
EMPNO NUMBER
EMPNAME VARCHAR2(10)
JOB VARCHAR2(10)
HIREDATE DATE
SAL NUMBER
After getting help from the members i was able to do the insert of data from the xml file to the table..how to do the insert of data from the table to the xml file.
Regards,
RenuHello michaels , thank you for the solution, still i am having some problems
Here is what i have done :
1.
SQL> CREATE DIRECTORY my_table_dir AS 'E:\table_files'
2 ;
Directory created.
2.
SQL> select * from myemp;
ENAME
SMITH
ALLEN
3.
This is the content of the existing xml file saved in the directory E:\table_files as emp.xml
<EMPLOYEES>
<EMP>JIM</EMP>
<EMP>RICK</EMP>
</EMPLOYEES>
4.
Now i executed this code :
declare
emp_xml xmltype;
begin
select sys_xmlagg (column_value, sys.xmlformat ('EMPLOYEES')) emp_xml
into emp_xml
from table (xmlsequence (cursor (select *
from myemp
where ename in ('SMITH', 'ALLEN')),
sys.xmlformat ('EMP')
dbms_xslprocessor.clob2file (emp_xml.getclobval (), 'E:\table_files', 'emp.xml');
end;
And the Error i got is :
declare
ERROR at line 1:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 18
ORA-06512: at "SYS.UTL_FILE", line 424
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 46
ORA-06512: at line 12 -
Import/export data from ms sql 7 to xml file in a particular xpdl format
I'm trying to write java program to import/export data from ms sql 7 to xml file in a particular xpdl format. Can anyone suggest how to do it?
take a glance at what these guys do: http://www.openbusinessengine.org/docs/guide.html
-
Export data from database table before database migration
Hello,
We are planning to migrate our SAP ERP 6 Ehp4/NW7.01 from Oracle 11.2 to IBM DB2 v. 9.7 database. During test migrations I have established that we spend a lot of time for one particular table (COEP). Because we donu2019t have possibility to archive this table before migration I have an idea to export data from previous years from this table to the file system (using an ABAP report), delete those data from table before migration and then after migration, import back to the database from the file system.
Does anybody have any concerns or suggestions about this idea?
Thank you for your answers
AndrejHello Andrej,
I strongly do not recommend to do so.
I am not sure whether technically this could work at all..
Even it if would work .. In order to really save time, the export and the import would have to be a dirty one (meaning the system is operational and in production). With this there is a high risk to produce inconsistencies on this table. And you most likely will receive no support if something unforeseen happens and you end with problems.
Also your approach (if it should work at all) , would have to be tested thoroughly by you , also protecting the table from any changes.
I do not believe that this can save any effort compared to implementing advanced migration techniques like table splitting.
On top, you would go high risk to end with an unsupported system, with not using official migration procedures
Hans-Juergen -
How to Export data from a Table to Excel using PL/SQL Code
Hi,
I need to export data from a table to the excel sheet using PL/SQL script.
could you pls provide with custom codes or sample procedures.
Bobbyhttp://asktom.oracle.com/pls/ask/f?p=4950:8:7947129213057862756::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:728625409049
-
[b]export data from a table to a csv or .txt file[/b]
hi plz i need help in how to export data from a table to a csv or .txt file
If you are using TOAD, then you can execute the statement like SELECT * FROM TABLE1
Then, you can go to Output Grid and you can say save as and you can save it as you want, excel, tab delimited or whatever.
Thanx,
Cheers, -
Export data from a table to text file using srcipt task
Hi
i am new to SSIS
i have to export data from a table and append it into a existing file through SSIS script task
please help
Thanks
UmeshHi Umesh,
The data structure of the source table and the structure of the destination file are the same, right? Is the destination file a flat file? Do you have to do it through Script Task? If the destination file is a flat file, this can be done easily by using
the stock tasks/components other than .NET code. In the Data Flow Task, we choose the appropriate source adapter (such as OLE DB Source or ADO.NET Source) to extract data from the source table, perform transformation if necessary, and then load to the destination
file via a Flat File Destination. When setting up the Flat File Destination, uncheck the “Overwrite data in the file” option so that the extracted data will be appended to the existing file.
If you need to implement it through Script Task/Component indeed, you may benefit from the following code examples:
http://stackoverflow.com/questions/8070163/how-to-add-custom-footer-to-an-ssis-flat-file-seperate-component-or-script-tas
http://stackoverflow.com/questions/8467326/add-header-and-footer-row-flat-file-ssis
If you need further help about the script, I suggest that you ask a new question in .NET forums where you can get more dedicated support:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=netdevelopment
Regards,
Mike Yin
TechNet Community Support -
Extract data from database tables and download in pdf and csv
extract data from database tables and download in pdf and csv
hi how can i re-write my old form procedure in adf java. the procedure used to extract data from diffirent table and dowload the data in pdf and csv.am not downloading image, i what to extract data from diffirent tables in my database and download that data in pdf and csv. i would like to write this in java adf.i just what direction am not asking anyone to do my work this is my learning curve
the form code is
function merge_header3 return varchar2 is
begin
return '~FACILITY DESCRIPTION~ACCOUNT NO~BRANCH CODE~BANK REF NO.~P/P/ AMOUNT~Postal Address 1~Postal Address 2~Box Postal Code~Dep. Date~Month~BANK NAME~BRANCH NAME~ACCOUNT TYPE~DESCRIPTION~OBJECTIVE DESCRIPTION';
end;
procedure download_file (i_pbat integer) is
dir varchar2(80);
file_name1 varchar2(80);
file_name2 varchar2(80);
appl_code varchar2(80);
fil1 client_text_io.file_type;
fil2 client_text_io.file_type;
dat varchar2(1000);
DATA VARCHAR2(1000);
bvspro varchar2(100);
ssch varchar2(100);
bvspro_total number(20,2);
ssch_total number(20,2);
grand_total number(20,2);
cnt integer;
cursor pbat is
select *
from sms_payment_batches
where id = i_pbat
cursor pay (pb_id integer) is
select *
from sms_payment_vw
where pbat_id = pb_id
order by subsidy ASC,programme,beneficiary_name
cursor cgref (low varchar2) is
select *
from cg_ref_codes
where rv_domain ='SMS'
and rv_low_value = low
success boolean;
begin
set_application_property(cursor_style,'busy');
appl_code := sms_global.ref_code('SMS','APP_CODE','SMS',0);
dir := sms_global.ref_code('SMS','PAY_DIR','c:\sms\batch_payments',0);
success := webutil_file.create_directory(dir);
if webutil_file.file_is_directory(dir) then
null;
-- message ('directory exists');
else
-- message ('create directory ');
success := webutil_file.create_directory(dir);
-- if success then message ('directory exists'); end if;
end if;
for c_pbat in pbat loop
file_name1 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'pay.txt';
file_name2 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'merge.txt';
--message('create files ');
-- fil1 := client_text_io.fopen (file_name1,'W');
-- fil2 := client_text_io.fopen (file_name2,'W');
fil1 := client_text_io.fopen (file_name1,'W','');
fil2 := client_text_io.fopen (file_name2,'W','');
dat := 'FROM ACCOUNT NUMBER'
||'~'||'FROM ACCOUNT DESCRIPTION'
||'~'||'MY STATEMENT DESCRIPTION'
||'~'||'BENEFICIARY ACCOUNT NUMBER'
||'~'||'BENEFICIARY SUB ACCOUNT NUMBER'
||'~'||'BENEFICIARY BRANCH CODE'
||'~'||'BENEFICIARY NAME'
||'~'||'BENEFICIARY STATEMENT DESCRIPTION'
||'~'||'AMOUNT';
-- client_text_io.put_line(fil1,dat);
bvspro:= null;
ssch := null;
cnt := 0;
dat := '~'||lpad('~',16,'~');
for c_pay in pay(c_pbat.id) loop
--message('cpay loop ' || cnt);
if bvspro is null then
dat := lpad('~',16,'~');
dat := utility.put_field(1,c_pay.programme,dat,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
ssch := c_pay.subsidy;
grand_total := 0;
bvspro_total := 0;
ssch_total := 0;
end if;
if bvspro <> c_pay.programme then
dat := lpad('~',16,'~');
dat := utility.put_field(5,ssch_total,dat,'~');
dat := lpad('~',16,'~');
dat := utility.put_field(5,bvspro_total,dat,'~');
dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
client_text_io.put_line(fil2,dat);
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.programme,dat,'~');
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
ssch := c_pay.subsidy;
bvspro_total := 0;
ssch_total := 0;
cnt :=0;
end if;
if ssch <> c_pay.subsidy then
dat := lpad('~',16,'~');
dat := utility.put_field(5,ssch_total,dat,'~');
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
ssch := c_pay.subsidy;
ssch_total := 0;
cnt :=0;
end if;
bvspro_total := bvspro_total + c_pay.amount;
ssch_total := ssch_total + c_pay.amount;
grand_total := grand_total + c_pay.amount;
cnt := cnt +1;
--message('bfore write file 2 ' );
client_text_io.put_line(fil2
,cnt
||'~'|| c_pay.beneficiary_name
||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER ||''
||'~'||c_pay.BRANCH_CODE ||''
||'~'|| c_pay.BENEFICIARY_STATEMENT_DESC
||'~'|| c_pay.AMOUNT
||'~'|| c_pay.address_line1
||'~'|| c_pay.address_line2
||'~'|| c_pay.postal_code
||'~'|| TO_CHAR(c_pay.deposit_date,'DD-Mon-YYYY')
||'~'|| c_pay.month
||'~'|| c_pay.bank
||'~'|| c_pay.bank_branch
||'~'|| c_pay.account_type
||'~'|| c_pay.subsidy
||'~'|| c_pay.programme)
DATA := c_pay.FROM_ACCOUNT_NUMBER
||'~'||c_pay.FROM_ACCOUNT_DESCR
||'~'||c_pay.MY_STATEMENT_DESCR
||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER
||'~'
||'~'||c_pay.BRANCH_CODE
||'~'||c_pay.BENEFICIARY_NAME
||'~'||c_pay.BENEFICIARY_STATEMENT_DESC
||'~'||c_pay.AMOUNT;
DATA := REPLACE(DATA, ',' , ' ' );
DATA := REPLACE(DATA, '~' , ',' );
--message (cnt ||' ' || data);
--message('bfore write file 1 ' );
client_text_io.put_line(fil1, data);
end loop;
--message ('end of write');
dat := lpad('~',16,'~');
dat := utility.put_field(6,ssch_total,dat,'~');
dat := lpad('~',16,'~');
dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
dat := utility.put_field(5,bvspro_total,dat,'~');
client_text_io.put_line(fil2,dat);
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,'Grand Total:' ,dat,'~');
dat := utility.put_field(5,grand_total,dat,'~');
client_text_io.put_line(fil2,dat);
-- close file
for i in 1..50 loop
if substr(i,-1) = 0 then
message ('flush ' || i);
end if;
client_text_io.put_line(fil1, lpad(' ',2000));
client_text_io.put_line(fil2, lpad(' ',2000));
client_text_io.put_line(fil1, lpad(' ',2000));
client_text_io.put_line(fil2, lpad(' ',2000));
end loop;
client_text_io.fclose(fil1);
client_text_io.fclose(fil2);
end loop;
set_application_property(cursor_style,'default');
exception
when others then
message(sqlcode ||' ' ||sqlerrm);
end download_file; i try this but this code onlydownload image not data from database tables
public void downloadImage(FacesContext facesContext, OutputStream outputStream)
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
// get an ADF attributevalue from the ADF page definitions
AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("DocumentImage");
if (attr == null)
return;
// the value is a BlobDomain data type
BlobDomain blob = (BlobDomain) attr.getInputValue();
try
{ // copy the data from the BlobDomain to the output stream
IOUtils.copy(blob.getInputStream(), outputStream);
// cloase the blob to release the recources
blob.closeInputStream();
// flush the output stream
outputStream.flush();
catch (IOException e)
// handle errors
e.printStackTrace();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), "");
FacesContext.getCurrentInstance().addMessage(null, msg);
}You should ask your forum in the ADF-forum.
-
ABAP program to output data from SAP table to an XML format file?
hello ABAP experts,
Does anyone know how to output data from SAP table to an XML format file? Would be appreciated if someone show the detailed sample codes and we will give you reward points!
Thanks!Edited by: Jose Hugo De la cruz on Aug 19, 2009 8:23 PM
-
Creating XML file using data from database table
I have to create an xml file using the data from multiple table. The problem That i am facing is the data is huge it is in millions so I was wondering that is there any efective way of creating such an xml file.
It would be great if you can suggest some approach to achieve my requirement.
Thanks,
-VinodAn example from the forum: Re: How to generate xml file from database table
Edited by: Marco Gralike on Oct 18, 2012 9:41 PM -
Can we export DATA from all tables in a schema?
Hi,
I have a question; Can we export all the DATA from all the tables present in the schema to any source (eigther CSV, TXT, DAt, etc..)?
Or
Can I have a PL/SQL procedure to display DATA from all Tables in a schema?
With Best Regards,
- NaveedHi,
This is pretty much what you need.
DECLARE
V_COUNT NUMBER;
v_sql varchar2(1000);
IN_OWNER_NAME VARCHAR2(100) := 'AP' ; -- SCHEMA NAME
TYPE T_COL_NAME is table of varchar2(1000) index by binary_integer;
v_col_tbl t_col_name;
BEGIN
FOR i in
(SELECT object_name
FROM dba_objects
WHERE owner = IN_OWNER_NAME
AND object_type ='TABLE'
and rownum < 2)
LOOP
v_sql := 'SELECT COUNT(*) FROM ' || i.object_name ;
EXECUTE IMMEDIATE v_sql INTO V_COUNT;
if v_count > 0 then
v_sql := 'SELECT * FROM ' || i.object_name ;
select column_name
bulk collect
into v_col_tbl
from DBA_TAB_COLUMNS
WHERE TABLE_NAME = I.OBJECT_NAME
AND OWNER = IN_OWNER_NAME;
-- start selecting the column and exporting using the column names selected.
end if;
if v_col_tbl.count > 0 then
for i in v_col_tbl.first .. v_col_tbl.last
loop
DBMS_OUTPUT.PUT_lINE(v_col_tbl(i));
end loop;
end if;
DBMS_OUTPUT.PUT_lINE( i.object_name || '-' || v_count);
END LOOP;
END;
- Ronel -
Export data from a table (not a bi query) to pdf
Hi experts,
I would like to know the way to export data in VC 7.0 from a table to a pdf. This table is generated NOT from a BI query but from an SQL using connection to Oracle DBMS.
Thank you all
AlessandroHi,
Use this link:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123]
and Go through he below thread.
[Re: Export data from visual composer to excel]
Regards,
Govindu
If helpful reward points -
Issues in exporting data from SAP tables in SE16 to excel
1.How can I save an sap table (displayed through SE16) in ECC6 into a pivot table in excel. [ I have seen this option in R/3 4.7, but do not see it in ECC.]
2.How can I copy all the rows of a 3000 row SAP table in SE16 and paste the values into excel. I need to do this in one shot and not page by page.
3.What option do I need to select inorder to preserve the formating of the values while saving as a local file in a spreadsheet format. All the values with leading zeros,like company codes gets saved with only their numeric portion when I save a SAP table as a local file. for eg company code 0001 gets saved in excel as just 1,company code 0056 gets saved as 56 etc. How do I prevent this? What option do I need to set in SAP in order for the values to be downloaded as is, without any truncation of leading zeros.1. I don't know. How about creating a pivot after exporting data
2. System->List->Save->local file->clipboard
Then paste whole lot in Excel
3. This is a problem with Excel, not SAP. SAP exports with leading zeroes.
You could export as flat file & import into Excel into a spreadsheet with an appropriate numbering format. -
Drop Down list in table with data from database table
Hi,
I have created an interactive form in WD ABAP.
In Context tab I have created the nodes as follows:
ZSOHEADER node with cardinality 1..1
|-> MATERIAL node with cardinality 0..n. Under MATERIAL node there are 2 attrib. MAKTX and MATNR.
I am fetching data from MARA table into an internal table IT_MARA.
The node MATERIAL is bound to internal table IT_MARA.
I have created a table with property ' Body rows vary depending on data ' .
I have only one row in table. The first cell of the row is a drop down field.
I have bind the field to the node MATERIAL->DATA->MAKTX.
Now the issue is even though I have created only one row in my table, in preview it is creating as many rows in the table as the no.of records in the internal table.
I want only one row with the drop down list containing all values of the internal table.
Kindly suggest what to do.
Regards,
VinodHi,
In the WebDynpro Context, in the main node create another node like A1 with cardinality 0..n and in this node create attributes TEXT and VALUE.
Now goto method and in that method using code wizard read the node A1.
And use the below code snippet sample in your program, i.e. code this under respective method of the webdynpro.
*Declare the TYPES
TYPES : BEGIN OF TY_TABLE,
TEXT TYPE SOMETYPE,
VALUE TYPE SOMETYPE,
END OF TY_UOM.
*Define Internal Table and work area.
DATA : IT_TABLE TYPE STANDARD TABLE OF TY_TABLE INITIAL SIZE 0,
WA_TABLE TYPE TY_TABLE.
SELECT TEXT VALUE FROM TABLENAME INTO TABLE IT_TABLE.
lr_node_info->bind_table( IT_TABLE ).
And in the Adobe Form Layout
Go to Menu of the Adobe LiveCycle Designer:
Tools>Options..>DataBinding
In that window you just check the Show Dynamic properties Check Box.
Now for the Drop Down go the binding tab in object palette and click on the list items and there specify the Internal Table and specify the text as the internal table text field and value as internal table value field.
OR
From the WebDynpro Native Library Palette use the Value Help Drop Down and in object pallette goto binding tab and provide the form interface binding. Before this in the WebDynpro goto Context and for the particular field under the properties provide the search help as dictionary search help and specify the name of the dictionary search help.
OR
We have another method of setting the Text and Value to the DDL directly in the WebDynpro by coding in the methods, I dont have much knowledge on this.
Regards
Pradeep Goli -
Extracting data from database table containg perticular string.
hi every body ,
can any body provide me a solution for extracting the OT01 data from kna1 table where the OT01 ends with the string 'town' .
exe : the O/P should be
midTOWN
newTOWN
there is one more query i am not able to execute the following statement .......why?
select ORT01 from KNA1 where ORT01 CS 'TOWN'.
write:/ kna1-ort01.
endselect.
it is showing a syntax error.......
Thank You.Hi Tippu,
Your select statement consists of CS whcih may not be a valid comparision operator because of which error is displayed have look of this..
data itab like kna1 occurs 0 with header line.
parameters: s_town like kna1-ORT01.
select ORT01 from KNA1 into table itab where ORT01 = s_town.
Fetch the city and concatenate with TOWN your issue will be sloved.
Cheers!!
Balu
Edited by: Balu CH on Oct 21, 2008 11:13 PM
Maybe you are looking for
-
Hi, how do I register my copy of mountain lion? I changed harddrives and I've been having permission problems with the harddrive that are stemming from the OS not being verified on my new harddrive. I purchased Mountain Lion from the App store on my
-
I've got a Mac G-4 PC, 450 MHZ and upgraded the software to the latest Tiger 10.4. I purchased an ADS USB Turbo 2.0 PCI which is Mac compatible. I installed the the card in the slot, loaded the software but the card's not working. Do I need to update
-
Losing the network over airport extreme
We have an airport extreme base station (802.11g) that is nearing 6 years of use. We occassionally lose the network connection to our machine from our airport extreme, both on the ethernet connection and the wireless. To get it back, we disconnect po
-
IMac screen going dim . . .
Lately my older imac screen has been somewhat dim when waking from sleep.... only happens sometimes, seems to be normally bright at the bottom, growing dimmer the further toward the top you look .... if I restart, everything is fine again. Hardware p
-
Can't select value in af:selectBooleanCheckbox
I have a query where i bring a column from this part of my query: DECODE((SELECT GR.GESDOPCCOD FROM GESDROL GR WHERE GR.GESDOPCCOD=GO.GESDOPCCOD AND(:PV_CODROL IS NOT NULL AND GR.GESDROLCOD=:PV_CODROL)),NULL,'NoRegistrado','Registrado')REGISTRADO I d