Home » SQL & PL/SQL » SQL & PL/SQL » How to write the records in the file using UTL_FILE package
How to write the records in the file using UTL_FILE package [message #191224] Tue, 05 September 2006 04:41 Go to next message
gold_oracl
Messages: 129
Registered: July 2006
Location: Westborough, MA
Senior Member
Hi all,
As we know, we can write varchar2 or raw type using utl_file.put_line or utl_file.put_raw respectively.
but i want to write records type in file.

for instance, my record is
record rec_type
(
a number;
b varchar2(20);
c date;
);

here i want to write all the values as records rathar than writting field by field.
i.e i do not want to write
utl_file.put_line(a||b||c)
instread of
i want to write as something like this...
utl_file.put_line(rec_type)

Any idea??


Thanks,
Thangam







Re: How to write the records in the file using UTL_FILE package [message #191246 is a reply to message #191224] Tue, 05 September 2006 07:05 Go to previous messageGo to next message
kimant
Messages: 201
Registered: August 2006
Location: Denmark
Senior Member
Hi

How about using the built in XML features?

Br
Kim
Re: How to write the records in the file using UTL_FILE package [message #191295 is a reply to message #191246] Tue, 05 September 2006 09:46 Go to previous messageGo to next message
gold_oracl
Messages: 129
Registered: July 2006
Location: Westborough, MA
Senior Member
i dont have any idea about XML...
Re: How to write the records in the file using UTL_FILE package [message #191302 is a reply to message #191224] Tue, 05 September 2006 10:49 Go to previous messageGo to next message
rigatonip
Messages: 50
Registered: December 2005
Member
You might take a look at this askTom link. He has a procedure that takes a query as a parameter and then uses utl_file to write out a delimited file. He has others to write to Excel if that's of use.

http://asktom.oracle.com/pls/ask/f?p=4950:8:13723893447422141851::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:235814350980
Re: How to write the records in the file using UTL_FILE package [message #191310 is a reply to message #191302] Tue, 05 September 2006 11:20 Go to previous messageGo to next message
gold_oracl
Messages: 129
Registered: July 2006
Location: Westborough, MA
Senior Member
Hi,
Thanks for you response..
i had checked it already. but here my erquirement is little bit different.
that is i have to generate the report. so formatting the output is mandatory.. that is why i wanted to ensure, is there any direct way to write the records in the file?


Thanks,
Thangam
Re: How to write the records in the file using UTL_FILE package [message #191321 is a reply to message #191310] Tue, 05 September 2006 12:53 Go to previous message
kimant
Messages: 201
Registered: August 2006
Location: Denmark
Senior Member
This due not make sense, at least not to me.

There is no builtin feature to write a record to a file - at least not that I know of.
You have to write Your own code here.

But what do You want to achieve?
What should read the file in the end?

Why not just use a fx. fixed spacing, tabs or similar to distinguish the columns, as many has done before. This is not a new issue - many has written record structures to files before....

Br
Kim
Previous Topic: error in sql script
Next Topic: Variable "in list" using PL/SQL Table
Goto Forum:
  


Current Time: Fri Dec 09 05:39:52 CST 2016

Total time taken to generate the page: 0.05393 seconds