Transfer Data from Oracle to EXCEL
Hello,
I would like to transfer data from an oracle table into an EXCEL-Spreadsheet -
while doing it, I got the error message
"-1002 : 37000 : java.sql.SQLException:[Microsoft][ODBC Excel Driver]'C$_0Output is not a valid name..."
I think I have correctly defined a logical + physical schema for the excel-file (test works and counts rows), and as knowledg-modules I use:
LKM: SQL to SQL and
IKM: SQL Control Append
Does anybody have an idea how to avoid this error-message and to make the transfer working?
Edited by: user10874105 on Jan 30, 2009 7:19 AM
Hi Ramesh,
yes, this points to the right solution -
The only issue that remains is that by default ODBC-Setting for EXCEL is limitted to 255 Chars.
Otherwise it works perfect!
Similar Messages
-
Query Data From Oracle to Excel
Dear all,
Please guide me to solve.
Regards
DharmaQuestion's Caption is : Data From Oracle to Excel
While you are asking :
data in execel (windows ) move to Oracle Database table (Linux *64)Anyway, if your question is export data from Excel to Oracle then below thread may be of your interest which are saying that you have to install Dg4ODBC on Windows and use the ODBC driver there.
When running DG4ODBC on Unix you need an ODBC driver on this Unix box which can connect to the MS Excel file. I'm not aware of any suitable driver so far that fulfills the ODBC level 3 standard required for DG4ODBC.
So instead of using DG4ODBC, get the Windows software of DG4ODBC and install it on a Windows machine. You can then connect from your Oracle database to the Dg4ODBC listener on Windows which then spawns the DG4ODBC process. This DG4ODBC process then uses the MS Excel ODBC driver to connect to the Excel sheet.
https://cn.forums.oracle.com/forums/thread.jspa?messageID=10466197
For this purpose there is separate forum too : [url https://forums.oracle.com/forums/forum.jspa?forumID=63] Heterogeneous Connectivity
Regards
Girish Sharma -
Extract data from Oracle in excel file
Hi,
I have a requirement where in I need to extract data from Oracle in excel file and the excel worksheet name should be "Data".
for eg. excel file name "AR Data_DDMMYY" and excel worksheet name "Data"
I have used the UTL_FILE API to extract the tab delimited data which can be opened in excel but it is not exactly an excel file as the worksheet name is same as the file name.
I tried using utl_file.fcopy and frename.
Is there any way to do this using PLSQL?
select * from v$version;
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
"CORE 10.2.0.5.0 Production"
TNS for HPUX: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - ProductionSample Code:
declare
cursor c is
select * from scott.emp;
v varchar2(100);
f utl_file.file_type;
file_name varchar2(100) := 'AR Data.xls';
dir varchar2(50) := 'CESDIR191710';
--select * from dba_directories
begin
f := utl_file.fopen(dir, file_name, 'W');
v := 'EMPNO'||chr(9)||'ENAME'||chr(9)||'JOB'||chr(9)||'SAL'||chr(9)||'HIREDATE'||chr(9)||'DEPTNO';
utl_file.put_line(f, v);
for i in c
loop
v := i.empno||chr(9)||i.ename||chr(9)||i.job||chr(9)||i.sal||chr(9)||i.hiredate||chr(9)||i.deptno;
utl_file.put_line(f, v);
end loop;
utl_file.fclose(f);
--utl_file.frename(dir, file_name, dir, replace(file_name, '.xls', '_')||to_char(sysdate, 'MMDDYY')||'.xls', false);
utl_file.fcopy(dir, file_name, dir, replace(file_name, '.xls', '_')||to_char(sysdate, 'MMDDYY')||'.xls');
end;Thanks
ImranImran Soudagar wrote:
Hi,
I was able to generate the excel 2007 file with the data using the package from below link;
http://technology.amis.nl/2011/02/19/create-an-excel-file-with-plsql/
but the requirement is to generate excel 2003 file.
I tried changing the .xlsx to .xls and it gives a note while opening the file "The file you are trying to open, abc.xls, is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"Then you have three options:
1) stop using anton's package and find another one that supports the old and deprecated version of Excel 2003
2) write your own package to produce an Excel file.
3) Upgrade your version of Excel to a recent version
I tried the programs from other links on the forum but I am still getting this message. The client does not want this message to be displayed as the excel file works as an input to another system.
Can anyone help me with the issue?
Also, is it true that the programatically generated excel file is actually an xml file which is renamed to .xls and hence it shows the message while opening such files?Yes, Excel supports several different formats for it's files. By default, if you save an XLS files from Excel, it writes it out in a Microsoft proprietary binary format, which you would be hard pushed to replicate easily from PL/SQL. Excel also has the ability to save it's files as XML format, which is more readable and easier to produce programatically, whilst still allowing you to have multiple sheets, formulas and formatting included in it. That's the format that most people who need formatting and multiple sheets opt for when programatically generating their data as excel workbooks. (There's also an SLYK format that people used to use before that, but it's not as flexible)
If you want to write your own, the easiest thing to do is to start with a blank workbook in Excel, and put in your basic requirements e.g. a couple of named sheets, and some data in different formats (number, date, text etc.) and different formatting options etc. Save that file in XML format from Excel and then open up the file using notepad/wordpad to look at the structure. There'll be a whole load of redundant rubbish Microsoft put in there, but you should be able to figure out the basic structure of XML required to give you what you want. -
Data from oracle to excel very urgent
hi all,
im using servlets for fetching the data from oracle , i want to display the data which i get from orcle in excel sheet. A code snippet regarding this is highly appreciated...
Thanks in advanceJust visit Jakarta's POI API. It is simple. You can create workbooks, cells etc. You can apply styles, insert charts. And its very simple
-
Hi,
I want to know how can data be spooled from Oracle table to MS Excel.Is this done with MS Query if so how can that be done?Any other solutions are appreciated.
Thanks,
VenkataYou will be much better off writing an excel spreadsheet that queries the data directly.
First of all you need to create an ODBC connection to the database using ODBC admin.
Then
(1) fire up a new excel worksheet.
(2) Choose Data->Get External Data->New Query
(3) Connect using ODBC
(4) choose any table, columns, etc - it doesn't matter.
(5) at the end pane tick the MS query button. to edit the query press the SQL button.
Easy. Be aware that (i) your query resides in the cell you started with, usually A1, and (ii) if you want to format the columns in the spreadsheet you need to uncheck the formatting boxes in MS Query -
Transfer data from diadem to excel
Hello,
I have a problem concerning data transfer from diadem 11.1 to excel 2003. I have several hundred of measuring channels in one group under diadem and I want to select only one hundred of them (always the same) and transfer it to excel at a specific place( One channel in one columns always the same too) to make some calculations and data treatment. The biggest problem is that channels under diadem have not always the same channel number depending of the measuring hardware and are not always all present depending of the test configurations( some sensor are not always in use). So I want to select the channel using the name of the channel (which is always the same).I was thinking to make a loop like this: ( I dont know the correct syntax sorry)
For i 1 to 100 '100 is the number of channel that i want to extract
if channelnames = channelnameslist (i) 'Channelnameslist would be the list of the channel names that I want to pick out.
then excel export at excel.column (i)
end if
else
Is something like that possible?
Thank you for your help.
MathieuHi Mathieu,
You have several options when exporting from DIAdem to Excel:
1) Use the Excel Export Wizard
2) Create a TDM or TDMS file and then load that file into Excel with the Excel TDM Add-in
3) Create an ASCII file and then load that ASCII file into Excel with its ASCII Import
4) Use ActiveX to send values directly to an Excel sheet
Each of these options has various pros and cons. For options 1-3 I would suggest you rearrange the selected channels in DIAdem into the order you want to see in Excel. You can either use the ChnMove() function or the ChnCopyExt() function for this purpose. Options 1-3 all have the ability to export a selection of channels from the Data Portal, but they will generally export them in the order they appear in the Data Portal, for options 2,3 you would use the DataFileSaveSel() command with either the "TDM" or the "CSV" DataPlugin parameter.
Option 4 is very flexible but is harder to program and is slower than the other three options. How many data points do you have per channel? How many hundred channels will you want to export at one time?
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
Transfer data from Oracle 7 to SQL server 2005
Hello guys,
I am new in Oracle and I need some help from you:
I have an Oracle database 7 and I need to transfer some tables into MS SQL Server 2005.
Is there any ORACLE utility (compatible with ver 7) to help me in this task?
If not, what is the way to trasfer data from a Oracle database 7 to SQL Server 2005?
Thank in advanceSQL Server can access Oracle database via the Linked Database feature however I do not know if you could find a Oracle 7 database compatiable Oracle client to use with a SQL Server 2005 database. i would not even try to configure this.
What I suggest is you use SQLPlus to spool out delimited data into flat files, copy/FTP etc ... those flat files to your SQL Server box, and use BCP to load the data into SQL Server.
There have been numberous posts of generating delimited flat files from Oracle data posted here on the forum but here is one method that will work on version 7:
How do I export a database table to a flat file ?
http://www.jlcomp.demon.co.uk/faq/flatfile.html
HTH -- Mark D Powell -- -
Aggregated data from oracle to excel report
Hi all,
I have a requirement where i need to fill in an excel report using aggregated data in oracle tables.
example: i need to find total number of employees in each department and the total salaries of each department. My excel report looks like below
DEPT|total employees| total salaries
dept 10|15|75000
dept 20|0|0
dept 30|20|100000
dept 40|5|25000
TOTAL|40|200000
declare
begin
execute immediate 'insert into abc select count(empid),sum(sal), dept_id from emp group by dept_id';
end;
the above query gives me the aggreagted output and then i need to manually insert the data into the excel report. Instead i need an oracle procedure that will automatically insert the data from abc table into the excel report.
i know that the utl_file is used to export the data, but never used.
any help will be really appreciated.
Thanks
SHi,
Output Oracle report into HTML:
sqlplus user/pass@inst
SQL> set feed off markup html on spool on
SQL> spool C:\MyReport.html
<br>
SQL> select * from SomeTable;
SQL> spool off
<br>
SQL> set markup html off spool off;
<br>
SQL>
- Open obtained html report with browser; Output Oracle report into EXCEL:
sqlplus user/pass@inst
SQL> set feed off markup html on spool on
SQL> spool C:\MyReport.xls
<br>
SQL> select * from SomeTable;
SQL> spool off
<br>
SQL> set markup html off spool off;
<br>
SQL>
- Open obtained xls with Excel;
- In case of warning message "The file you're trying to open ... is in a different format ...
Do you want to open the file now? - press "Yes"
{code}
Good luck!
http://dba-star.blogspot.com/ -
Export Data from Oracle 10g and import in SQL server
Hi Guys,
I have assigned a task in which I am required to transfer data from oracle database to SQL server. I have not done this before. Can anybody help me the easiest way to accomplish this. ThanksOne way of doing this is setup Heterogeneous Database connections
http://www.dba-oracle.com/t_heterogeneous_database_connections_sql_server.htm
I am sure there's other options out there. -
Retrieve specific range data from oracle table
Hi, Dear friends,
I want to retrieve all the data from oracle table and then save them to mysql table using JDBC ResultSet. The problem is that some oracle table is too big, if I retrieve all of them to memory at a once time using excuteQuery, the program will become no response out of memory limitation. So my question is if I can retrieve just specific range data once a time. I can¡¯t find this function through JDBC API. Also, I don¡¯t want to use the specific sql sentence, for example ¡°select ¡ from¡ where someid>¡ and someid<¡¡±, because there are many different tables, I want to transfer them automatically. So I can¡¯t construct such sql sentence in advance. Does anyone know if oracle JDBC driver provide such kind of function or does there any other way?
Any suggestion will be greatly appreciated!
SammyDear Justin,
thank you so much for your prompt reply!
as your suggestion, I do check the performance while my program is running, after the program become nearly no response, I found the memory usage is nearly 100%, while disk usage and process usage is pretty low. that's the reason why I guess maybe the memory limitation, but the strange thing is that no any error reported by JBuilder, it just nearly no response and don't transfer any data any more. my os is windows xp, the version of JBuilder is 7. my main memory is 768M. just as you said, the total 6,000 records in not very large, just no more than 400K. another strange thing is that why my program works well when there is little data records in the table.
the big picture of my program is first I retrieve oracle table metadata, according to this information, I construct DDL sql words and then create the corresponding table in mysql database. this part works well. in order to save your time, I will not paste the code here. then there is a method to transfer oracle data to mysql table, whenever creating the mysql table, then I will call this method to transfer datat to it. the following is the code of this method, I am very sorry to take your time. please read it when you are available.
thank you very much!!
Sammy
//transfer data from oracle to mysql!!!
private static void transferData(Connection oracleConn, Connection mysqlConn, String oracleTableName, String oracleSchemaName) throws SQLException{
Statement oracleStmt=oracleConn.createStatement();
Statement mysqlStmt=mysqlConn.createStatement();
// sending sql to oracle to retrieve data
String thisTableName=oracleTableName;
String oracleSQL="SELECT * FROM ".concat(thisTableName);
ResultSet oracleRS = oracleStmt.executeQuery(oracleSQL);
String sql="";
if (oracleRS.next()) {
ResultSetMetaData rsmd = oracleRS.getMetaData();
int colCount = rsmd.getColumnCount();
do {
String sqlBodyPart="";
String sqlValuePart="";
System.out.println("the number of column is "+colCount);
for (int i = 1; i <= colCount; i++) {
String columnValue = oracleRS.getString(i);
boolean b = oracleRS.wasNull();
String columnName =rsmd.getColumnName(i);
System.out.println("the value of column " + i + "is " + columnValue);
//construc the sql body part and value part
sqlBodyPart=sqlBodyPart.concat(" ").concat(columnName).concat(",");
if(b){ //if the value of the column i is null
sqlValuePart=sqlValuePart.concat(" null").concat(",");
}else{
sqlValuePart=sqlValuePart.concat(" '").concat(columnValue).concat("',");
//get rid of the last comma in sqlBodyPart and sqlValuePart
if(!sqlBodyPart.equalsIgnoreCase("")) sqlBodyPart=sqlBodyPart.substring(0,sqlBodyPart.length()-1);
if(!sqlValuePart.equalsIgnoreCase("")) sqlValuePart=sqlValuePart.substring(0,sqlValuePart.length()-1);
//construct the sql sentence!!!
sql="INSERT INTO ".concat(thisTableName).concat(" (").concat(sqlBodyPart).concat(") ").concat(" VALUES(").concat(sqlValuePart).concat(")");
System.out.println("the sql words for this column is");
System.out.println(sql);
System.out.println(" ");
if(mysqlStmt!=null){
int rows = mysqlStmt.executeUpdate(sql);
} else{
System.out.println("can't connect with mysql server");
System.exit(1);
while (oracleRS.next());
} else {
System.out.println("There are no data in the table...");
}//end of method data transfer!
//end of method data transfer! -
Transfer data from MS Excel to Oracle table
Hello,
hope someone can help: What is the easiest way to transfer data from Excel sheet to a Oracle table and how ?
An example of a row to transfer is given below
Date Time Value 1 Value 2
2004-02-02 03:47:39 9,62 3,62
Thanks in advance
Regards
RoarFrom Microsoft access , import data from Excel to an Access table.
Format that Access Table properly in Design mode.
Create a table as per your specification in oracle Database.
Then export to oracle from access using approppriate ODBC driver.
--Sayan -
Transfer Data from excel to text file or SAP R/3
Hi,
Can anyone please let me know if there is any function module to transfer data from excel to a .txt file.
I am using a CRM 5.0 system and some standard SAP function modules are missing.
I want to fetch data from excel to SAP R/3.
Wish you great time.
Best Regards
SidHi Sid,
extracting data from an excel sheet to SAP u can use the function module GUI_UPLOAD.
I am providing u its parameters also as it might be useful to u.
The mandatory fields here are FILENAME n in TABLES (in which u will be saving ur data).
and also if u need to download from sap to any file u can use GUI_DOWNLOAD in which u can save data in both excel or txt file.
U can also use SAP_CONVERT_TO_TEX_FORMAT function module to convert into text file.
Rewards would be highly appreciated. Thanks.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME =
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Fetch tablespace data from Oracle database(HP UNIX server) to excel Sheet
Hi team,
I have 5 oracle databases and they all are on different machines. i want to fetch data(tablespace data) from db to excel.
here is my macro code
Sub tbs_STD()
Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim Cmd As New ADODB.Command
Dim sqlText As String
Dim Row As Long
Dim Findex As Long
Dim STD As Worksheet
Dim X As Long
Dim UID As String
Dim PWD As String
Dim Server As String
UID = "monitordb"
PWD = "monitor1"
Server = "STD"
Set STD = ActiveSheet
STD.Select
Conn.Open "PROVIDER=MSDAORA.Oracle;DATA SOURCE=" & Server & ";" & _
"USER ID=" & UID & ";PASSWORD=" & PWD
Cmd.ActiveConnection = Conn
Cmd.CommandType = adCmdText
sqlText = "select sum(a.tots/1048576) Tot_Size,sum(a.sumb/1048576) Tot_Free,round(sum(a.tots-a.sumb)*100/sum(a.tots),2) Pct_used,sum(a.largest/1024) Max_Free,sum(a.chunks) Chunks_Free from(select tablespace_name,0 tots,sum(bytes) sumb,max(bytes) largest,count(*) chunks from dba_free_space a group by tablespace_name union select tablespace_name,sum(bytes) tots,0,0,0 from dba_data_files group by tablespace_name) a group by a.tablespace_name order by a.tablespace_name"
Cmd.CommandText = sqlText
Set RS = Cmd.Execute
For X = 0 To 4 ' Number of columns returning minus 1
'Data.Cells(1, X + 1) = RS.Fields(X).Name
Next
Do While Not RS.EOF
Row = Row + 1
For Findex = 0 To RS.Fields.Count - 1
STD.Cells(Row + 2, Findex + 67) = RS.Fields(Findex).Value
Next Findex
RS.MoveNext
Loop
End Sub
I am able to connect through sqlplus on all machines but when i run the above code it gives me TNS error..
ORA-12154- TNS could not resolve the connect identifier specified..
Each database use same port 1527 and only one of them is able to fetch the data. and if i remove that database from client then the other one starts connecting. I think problem is due to same port number.
Entries in the listener.ora file was made throough oracle client only 32bit.
and i have installed both 10g and 11g client on my local machine.
Please help.You need to configure tnsnames.ora in your OracleClient\network\admin folder with the TNS entries for the servers you're connecting to.
-
How to I convert data from oracle database into excel sheet
how to I convert data from oracle database into excel sheet.
I need to import columns and there datas from oracle database to microsoft excel sheet.
Please let me know the different ways for doing this.
Thanks.asktom.oracle.com has an excellent article on writing a PL/SQL procedure that dumps data to an Excel spreadsheet-- search for 'Excel' and it'll come up.
You can also use your favorite connection protocol (ODBC, OLE DB, etc) to connect from Excel to Oracle and pull the data out that way.
Justin -
Transfer data from two oracle version to one sql server 2005
Hi,
I have two database servers on different machines. They are
1) Oracle 8.1.7.4
2) Oracle 7.3.1.4
I have to create agents which can transfer tables from these two databases to one machine having sql server 2005 database.
Please tell me what are the options. What drivers i need to install on machine having sql server 2005 so that i can transfer data from both oracle versions.
Thanks
Rajneesh.Your Oracle databases are so old you might want to look around and see if you can find dinosaur bones near by.
Given the differences in data types between Oracle and SQL Server I'd suggest you start off by dumping the data into delimited ASCII files and then loading it using whichever SQL Server tool you wish.
Maybe you are looking for
-
Well, I'm receving constantely the arab text code by mail or on Twitter app (by IOS) and all aplications crashes. Sometimes I'm surfing and the god dammit code is in the homepage source and crash the aplications. The same thing at IOS. I'm without i
-
Hard Drive Replacement for 400MHZ G4 Titanium PowerBook
Hi All I am waiting for my Powerbook G4 400mhz to be shipped and would like to upgrade the hard drive but I am not too sure what type to get. Can anyone help me with this please? Should I be looking for a IDE/ATA/PATA 2.5" Drive and what's the maximu
-
Being charged £22.50 for BT Sport HD
For the last 2 months (1st July and 4th August) £22.50 has been taken from my bank account for BT Sport HD when I should only be charged £15. I phoned BT after the first payment of £22.50 was taken and the woman I spoke to said she put it on the syst
-
Drawing a straight line over a video
Is it possible to draw a straight line over a video in CS6 and also to watch the video frame by frame to take exact timings?
-
Where is itunes windows xp 64bit edition ?
please ..i want itunes .my windows xp 64bit edition ....