Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: flat file
In article <81m71b$e6c$1_at_nnrp1.deja.com>,
John Duran <d3plan_at_hotmail.com> wrote:
> I need to send a fixed length file composed of header information and
> order information to a legacy system. (320 characters)
>
> Where can I find an example on how to do this within ORACLE 8.0.5
> running on a Sun SPARC with Solaris 2.6.
>
> Basically every day a batch file needs to be created with billing
> information or basic customer information - and a series of orders
each
> with a unique ORDER_ID and information concerning items purchased,
> shipping information etc.
>
> Each detail file may have up to four different types of files each in
a
> 320 fixed length character set. Each file type is designated by a 2
> digit file type. re: type 10 is 'Buyer Info', type 30 is 'Shipping
> Info' type 40 is the 'Line Item Record' - one for each item ordered.
>
> John
>
It is fairly easy to write out a fixed format flat file from SQL*Plus
using the spool command along with a couple of set options like
linesize 320, feedback off, pagesize 0, and maybe verify off. You
should be able to find examples in the SQL*Plus manual.
The question becomes what do you have to do to create your file(s) data. Using Unix utilities like cat, sed, and cut you should be able to construct your file if you need to merge multiple output files.
And if the data construction is complex you could resort to Pro*C or maybe pl/sql using the utl_file package to write out a text file.
You might be able to add some of the type data to your result sets by
selecting constants. I hope this helps some.
--
Mark D. Powell -- The only advice that counts is the advice that
you follow so follow your own advice --
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Nov 26 1999 - 13:14:45 CST