[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


Text File generation in oracle

Posted on 2013-06-18
Medium Priority
Last Modified: 2013-06-29
Can anybody tell me, how to generate text file in oracle without using UTL_FILE_DIR ?
Question by:gotetioracle
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Assisted Solution

by:Alexander Eßer [Alex140181]
Alexander Eßer [Alex140181] earned 1000 total points
ID: 39255509

see chapter "Unloading data into an external file..."

Author Comment

ID: 39255665
hi Alex140181,

I want to generate a text file from the sql query output without using  UTL_FILE_DIR .

LVL 14

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 39255671
Did you READ the chapter from my link above?!? -> no use of UTL_FILE
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.


Author Comment

ID: 39255787
i read but the document does not tell how to write a data from a table to a csv file.
LVL 35

Expert Comment

ID: 39255953
I'm a little confused.  Are you trying to avoid using the UTL_FILE_DIR parameter, or the UTL_FILE package.

You can use UTL_FILE without setting UTL_FILE_DIR.  You just have to have a directory object within Oracle that points to the directory where you want the file to be placed.  They are created with the CREATE DIRECTORY command.  Doc for CREATE DIRECTORY -> http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_5007.htm#i2061958
LVL 77

Accepted Solution

slightwv (䄆 Netminder) earned 1000 total points
ID: 39256004
There is always sqlplus and the spool command.

There are several ways to generate a CSV.  If you are using 11G, I suggest the LISTAGG function.

If not, I suggest the XMLAGG approach:

There are more listed here:

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question