Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to manage two OS Text files in UTL_FILE Package simultaneously?

Re: How to manage two OS Text files in UTL_FILE Package simultaneously?

From: Sharbat <sharbats_at_hotmail.com>
Date: 28 Apr 2004 09:37:17 -0700
Message-ID: <68aa131b.0404280837.3742a753@posting.google.com>


Hi Noel,

With regards to my problem,could you send a UTL_FILE sample routine (if possible) in which two OS text files reads at a same time & then inserted into the table?

This will be helpful form me.

Regards

Sharbat

"Noel" <tomekb_at_softman.pl> wrote in message news:<c6o1en$lqo$1_at_inews.gazeta.pl>...
> Add exceptions section to procedure and you see where it fails...
> You said nothing about a error message...
> >
> >
> >
> > Declare
> >
> > l_file_handle1 UTL_FILE.FILE_TYPE;
> >
> > l_file_handle2 UTL_FILE.FILE_TYPE;
> >
> > l_buffer1 VARCHAR2(4000);
> > l_buffer2 VARCHAR2(4000);
> >
> >
> > BEGIN
>
> BEGIN
> > l_file_handle1 := UTL_FILE.FOPEN('c:\Test\Result', 'System_Name.txt',
> > 'r', 4000);
> EXCEPTION WHEN OTHERS THEN
> DBMS_OUTPUT.PUT_LINE('Unable to open file1');
> END;
>
> BEGIN
> > l_file_handle2 := UTL_FILE.FOPEN('c:\Test\Result',
> > 'Machine.txt', 'r', 4000);
>
> EXCEPTION WHEN OTHERS THEN
> DBMS_OUTPUT.PUT_LINE('Unable to open file2');
> END;
>
>
> > loop
> >
> > UTL_FILE.get_line(l_file_handle1,l_buffer1);
> > UTL_FILE.get_line(l_file_handle2,l_buffer2);
>
> BEGIN
> > insert into test (Hostname,Machine) values(l_buffer1,l_buffer2);
> EXCEPTION WHEN OTHERS THEN
> DBMS_OUTPUT.PUT_LINE('Unable to insert row in a table'||chr(10)||sqlerrm);
> END;
>
> > commit;
> > end loop;
> >
> > exception
> >
> > when no_data_found then
> >
> > UTL_FILE.FCLOSE(l_file_handle1);
> > UTL_FILE.FCLOSE(l_file_handle2);
> >
> > when others then
> >
> > if utl_file.is_open(l_file_handle1)
> > then
> > utl_file.fclose(l_file_handle1);
> > end if;
> >
> > if utl_file.is_open(l_file_handle2)
> > then
> > utl_file.fclose(l_file_handle2);
> > end if;
> >
> > end;
> >
> > /
Received on Wed Apr 28 2004 - 11:37:17 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US