Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How write results of Select into sequential file?
Try:
SET LINESIZE 132
SET HEAD OFF
SET PAGESIZE 999
SET WRAP OFF SET SPACE 1
select field1 || char(9) || field2 || char(9) || field3 from yourtable;
char(9) is used as a 'tab' delimiter or you can use other characters. To do fixed length use LPAD and RPAD functions on the fields that you want and don't use any field delimiters.
hope it helps
hparks_at_mlock.com wrote:
>
> In article <6jatvo$moc$1_at_news1.rmi.net>,
> "Roger Loeb" <rloeb_at_martech.com> wrote:
> >
> > So, I know how to load a table from a file with fixed length records (using
> > SQLLDR), but how do I write such a file. I need to extract specific fields
> > from a table, concatenate them together to form a "record," append a
> > linefeed, and write the records to a sequential file. There are about 50
> > million 180-byte records involved in this process.
> >
> > I know how to do it using C and OCI, but I'm curious if there's a way to do
> > it directly in Oracle with SQL and ???
>
> The UTL_FILE package is designed for this purpose. I can't give any advice on
> it because I can't get it to work, myself.
>
> We create a table whose only field is varchar2(132). We insert the records
> into these fields, and use the SQL*Plus SPOOL command to store the records
> into a file.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
Received on Wed May 13 1998 - 12:42:12 CDT