Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: UTL_FILE code example
declare
f utl_file.file_type; cursor c1 is select emp_name,emp_dept,emp_salary from employee; begin f:= utl_file.fopen ('d:\temp', 'example.txt', 'w'); for r in c1 loop utl_file.put_line (f, r.emp_name || r.emp_dept || r.emp_salary); end loop; utl_file.fclose (f); exception when others then if (utl_file.is_open (f)) then utl_file.fclose (f); end if; raise;
Martin
prakbala_at_hotmail.com wrote:
>
> Will someone please give me an example of how to write
> a file out using UTL_FILE function ?
>
> For ex:
>
> cursor c1 is
> Select emp_name,emp_dept,emp_salary from employee;
>
> I would like to write this info to a flat file. Also I would
> like to know what changes I need to make in ORAINIT file for
> default UTL_FILE directory of C:\flatfile.
>
> Thank You.
>
> PB
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Sun Sep 05 1999 - 08:09:50 CDT