?
Solved

Creating Fixed length Text file from Oracle 9i table.

Posted on 2008-10-30
4
Medium Priority
?
970 Views
Last Modified: 2013-12-19
Hi,
  I am trying to generate a fixed length text file from Oracle 9i table.
Ex:
  My expected output is
  Positon       Field
  1-10           First Name
  11-20         Last Name
   20-40        Address
My output is going to look like this:
Steveson  Cathy     Washington DC
Robbs       Valles    Maryland

What is best way i can do, UTL_FILE or Spool or some other approach? If so how to do?

Thanks.
0
Comment
Question by:jainulap
[X]
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
4 Comments
 
LVL 27

Accepted Solution

by:
sujith80 earned 120 total points
ID: 22847497
spool approach.

set heading off
set pages 0
set echo off

select rpad(firstName,10)||rpad(lastName,10)||rpad(address,20)
from <table>;
0
 
LVL 9

Expert Comment

by:MarkusId
ID: 22848449
Or you can define columns (also spool, the rpad-approach wou8ld also work with utl_file)

set heading off
set pages 0
set echo off
set trimspool on
col firstName format a10
col lastName format a10
col address format a20

spool filename

select firstName, lastName, address
from <table>;

spool off

Have also a look at http://www.psoug.org/reference/sqlplus.html about the possibilities of column-formatting in Oracle
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

764 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