Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL UTL_FILE output
Randy Harris wrote:
> "DA Morgan" <damorgan_at_x.washington.edu> wrote in message > news:1111262663.460426_at_yasure... >
> > I've >>>>
>>>>>written a simple procedure to write some data out to a file. I would
>>>
>>>like
>>>
>>>
>>>>>the file to have fixed width fields, seperated by pipes. The data gets
>>>
>>>out
>>>
>>>
>>>>>to the file OK, but not fixed width. What can I do to correct that?
>>>
>>>Also,
>>>
>>>
>>>>>please point out my rookie mistakes.
>>>>
>>>>If the original columns are varchar2 you would need to use RPAD
>>>>everywhere to properly lineup your data. As you already have a
>>>>separator, I'm not sure what compelling reason there is (other than to
>>>>waste disk space), to do this.
>>>>
>>>>Your sql statement is of course horrible. It is not formatted at all,
>>>>and it uses hardcoded literals all over the place. Procedures and
>>>>cursors have parameters. In your case you would probably create 1000
>>>>almost identical procedures, except for the hardcoded literals, and
>>>>choke your CPU to death by doing so.
>>>>
>>>>
>>>>--
>>>>Sybrand Bakker, Senior Oracle DBA
>>>
> > how >
> > > I don't understand your statement. There are thousands of values in the > column, but only three that are excluded in this query. Please explain what > you mean.
Precisely why we are advising you to dump the literals. You are thinking that somehow what you do in your system is independent of what happens in other systems. A great recipe for disaster. No doubt the other people working in the same instance are all thinking the same thing ... me me me while Oracle is saying ALL OF YOU.
Dump the literals. And make sure everyone else does too.
For more information on why read Tom Kyte's book "Expert one-on-one Oracle."
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Sat Mar 19 2005 - 16:29:30 CST
![]() |
![]() |