Java Mailing List Archive

http://www.dba.5341.com/

Home » Home (12/2007) » oracle l »

Re: UTL_FILE question

Connor McDonald

2004-02-01

Replies:

declare
prev_mth number := -1;
begin
for i in my_big_24mth_cursor loop
  if to_number(to_char(i.date_of_interest,'MM')) != prev_mth then
    if utl_file.is_open(f) then
       close file;
    end if;
    open file;
    prev_mth := to_number(to_char(i.date_of_interest,'MM'));
  end if;
  write line to file
end loop;
end;

or thereabouts

hth
connor


--- Viktor <stant_98@(protected),
>
> I have a procedure that open a cursor and dumps some data for last 24 months to a file. The date
> range is static condition defined inside the cursor. Procedure is working great, but I what I'm
> having problem figuring out is if there is a way to create not one file with all the data, but
> multiple files with monthly sets of data. This way data for month1 is created as
> <filename_012002.txt> and so forth.
>
> Thanks much!
>
> Viktor
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
>
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to: oracle-l-request@(protected)
> put 'unsubscribe' in the subject line.
> --
> Archives are at http://www.freelists.org/archives/oracle-l/
> FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------

=====
Connor McDonald
Co-author: "Mastering Oracle PL/SQL - Practical Solutions" - available now
web: http://www.oracledba.co.uk
web: http://www.oaktable.net
email: connor_mcdonald@(protected)

"GIVE a man a fish and he will eat for a day. But TEACH him how to fish, and...he will sit in a boat and drink beer all day"

________________________________________________________________________
BT Yahoo! Broadband - Free modem offer, sign up online today and save £80 http://btyahoo.yahoo.co.uk
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------


©2008 dba.5341.com - Jax Systems, LLC, U.S.A.