473,553 Members | 2,945 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exporting data from oracle to excel

NawazAhmed
36 New Member
Hi,
I saw the same titled post but the answer given there is abt how to import data from an input file.
I know this can be done once u can get data from database in ur application using java,.net or any other language but I want to accomplish this inside the query itself.

I've found the code for the same but this query is written for mysql, I am looking for somthing on the same line in oracle.
This is the link for solution to my question, in mysql query using java language.
http://www.java-tips.org/other-api-t...-csv-file.html

the query used here in mysql is:
Expand|Select|Wrap|Line Numbers
  1. "SELECT id,text,price into OUTFILE  '"+filename+ "' FIELDS TERMINATED BY ',' FROM testtable t"
  2.  
  3.  
Thanks,
Nick.
Oct 30 '08 #1
9 20831
Pilgrim333
127 New Member
I don't get what you mean.

Do you want to import data into Oracle from Excel, or do you want to export data from Oracle to Excel?

Do you want to do it just by using SQL or are you using PL/SQL as well?
Oct 30 '08 #2
NawazAhmed
36 New Member
As I mentioned I want to do this with oracle (PL/SQL).
I need the same kind of query in pl/sql which I have written in mysql.
Oct 30 '08 #3
Pilgrim333
127 New Member
I really don't read mySQL.

There is a difference between SQL and PL/SQL in Oracle. SQL is the query language and PL/SQL is the programming language.

If you want to get it in a query and the output is csv then the SQL query could be something like:

SELECT column_name1 || ';' || column_name2 || ';' || column_name3 etc.
FROM table.

You can replace the semicolon by any seperator you want, just make sure it is between single quotes.

Make sure the output is send to a file, and you are done.

Pilgrim.
Oct 30 '08 #4
debasisdas
8,127 Recognized Expert Expert
That can be easily done by using some tools like toad,pl/sql developr or query reporter.
Oct 31 '08 #5
NawazAhmed
36 New Member
I really don't read mySQL.

There is a difference between SQL and PL/SQL in Oracle. SQL is the query language and PL/SQL is the programming language.

If you want to get it in a query and the output is csv then the SQL query could be something like:

SELECT column_name1 || ';' || column_name2 || ';' || column_name3 etc.
FROM table.

Make sure the output is send to a file, and you are done.

Pilgrim.
Thanks for the reply guyz.
Pilgrim333 I was really looking for something like that but can I transfer that result to a file directly from the query something like
SELECT column_name1 || ';' || column_name2 || ';' || column_name3 etc.
FROM table into outputfile "filelocati on"
Oct 31 '08 #6
Pilgrim333
127 New Member
Hi,

You can spool the output of the query to a file. In your sqlplus window just give the following commands:

Expand|Select|Wrap|Line Numbers
  1. SQL> Spool on
  2. SQL> Spool c:\output.csv --file you want the output generated to
  3. SQL> <query>
  4. SQL> Spool off
  5.  
Pilgrim.
Oct 31 '08 #7
NawazAhmed
36 New Member
Hi,

You can spool the output of the query to a file. In your sqlplus window just give the following commands:

Expand|Select|Wrap|Line Numbers
  1. SQL> Spool on
  2. SQL> Spool c:\output.csv --file you want the output generated to
  3. SQL> <query>
  4. SQL> Spool off
  5.  
If I am passing the query from the java program to the database, then how that would b using spool.
Will that be something like this??
str = "Spool on
Spool c:\output.csv
SELECT column_name1 || ';' || column_name2 || ';' || column_name3 etc.
FROM table
Spool off"
Nov 3 '08 #8
Pilgrim333
127 New Member
Hi,

I read over the part of Java. Spool is an SQLPlus command, so i don't think you can submit it using Java.
But if you are using Java, wouldn't it be a lot easier getting the result back in Java and create your Excel file from Java?

Pilgrim.
Nov 3 '08 #9
NawazAhmed
36 New Member
Hi,

I read over the part of Java. Spool is an SQLPlus command, so i don't think you can submit it using Java.
But if you are using Java, wouldn't it be a lot easier getting the result back in Java and create your Excel file from Java?
Yes I already implemented that......was just curious to know if it can work this way............ ..But thanks for all ur help.
Nov 3 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7986
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
3
9230
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works only exporting to single worksheet. but i need to export data to multiple worksheets. it is very urgent to us. so please help me in code.
4
3931
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear" TEXT field that contains data such as 2000/01, 2001/02, etc. If I export a Query with this kind of data to Excel, it gives me the text value of...
2
7698
by: G | last post by:
When I export data from access to excel by with "export" or "Analyze with" I seem to loose parts of some fields (long text strings). Is there a way to export it all to excel? Thanks G
2
2298
by: pmud | last post by:
Hi, I am exporting data from an EDITABLE DATA GRID EXCEL. But the 1st column in data grid is Edit Column. I want to display all columns in Excel except for the Edit column. The following code which I am using allows exporting only from text data from data grid & not from Edit columns which are link buttons. How to leave this column...
2
2394
by: bienwell | last post by:
Hi, I have a question about exporting data from datagrid control into Excel file in ASP.NET. On my Web page, I have a linkbutton "Export data". This link will call a Sub Function to perform exporting ALL data from the datagrid control. Exporting data works fine when I show all data on the datagrid control. I'd like to shows only 30...
2
3162
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to set this up so as to do it reliably and minimize overhead? There are currently no constraints on the destination table. Assume the user or some...
2
2069
by: Paige | last post by:
Hi, I use the exporting function in Oracle financials 11i, but since yesterday it has stopped working. I get a box appearing saying that the information has been exported, but I don't get given the option to open it in Excel. This is a big problem, as I export data every day. If someone can tell me how to fix it, that'd be great. Thanks
0
2706
by: khushpin | last post by:
I am looking for a procedure which can export data from Oracle to Excel.
7
12278
by: leninv | last post by:
Hi, I have the following code where 'recs' is a record set. For i=0 to recs.Fields.Count - 1 if i = 0 then pindnt = string(itmlvl*2," ") response.write pindnt & recs(i) else Response.write recs(i)
0
7492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7772
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7526
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5133
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3537
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3525
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1106
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.