Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: formatting output with SQL*Plus
On Wed, 08 Dec 2004 18:08:49 +0100, Thomas Kellerer
<NNGNVRDSJEBN_at_spammotel.com> wrote:
>Hello,
>
>I'm hitting the old problem that I need to spool data into a text file, but
>SQL*Plus insists on padding the fields to the length of the column definition.
There is a way which I've used to make the dbms_metadata.get_ddl package spool out a decent usable (as DDL SQL) piece of code, this might help you. Look for the put_line PL./SQL procedure which has a "compress" 2nd argument to squeeze out the irritating space-to-EOL chars.
I got this from http://adp-gmbh.ch/ora/misc/oru_10028.html
It's all clean readable code. You can modify this package, then select your stuff into a varchar2, then put_line(that varchar2, boolean) where boolean is TRUE for that "compression", which you can readily fix to your taste. Does require some PL/SQLing but that's Just Another Language really :-)
HTH
-- New anti-spam address cmylod at despammed dot comReceived on Wed Dec 08 2004 - 12:15:20 CST