472,331 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

exporting data from oracle to excel

NawazAhmed
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 20706
Pilgrim333
127 100+
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
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 100+
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 Expert 4TB
That can be easily done by using some tools like toad,pl/sql developr or query reporter.
Oct 31 '08 #5
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 "filelocation"
Oct 31 '08 #6
Pilgrim333
127 100+
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
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 100+
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
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
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
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...
4
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...
2
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...
2
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 ...
2
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". ...
2
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...
2
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...
0
by: khushpin | last post by:
I am looking for a procedure which can export data from Oracle to Excel.
7
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 =...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.