Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Srinivasa.

Asked: November 11, 2009 - 5:02 pm UTC

Last updated: November 12, 2009 - 10:47 am UTC

Version: 10.2.0.4.0

Viewed 1000+ times

You Asked

Hi Tom,

Thanks in advance for your help on this.

I was trying to find a way to append one file to other in PL/SQL with out actually reading/writting line by line.

For example,

File1 is as below.

12345

File2 is as below.

abcde

I wanted to create file3 appending file1 and file2 without actually reading and writting file1 and file2 line by line.

File3 would look like.

12345
abcde

Hope I am clear in asking my question.

Thanks,
Srini Kini

and Tom said...

Now, if you want to truly append, you would just have file2 at the end.

you would open file1 in append mode.

http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/u_file.htm#i1003526

and then open file2 in read mode

and then read file2 and write to file1.

and then close them.



If you want this new file3 - then you are NOT appending, you are creating a brand new file. And it would be:

use utl_file.fcopy to copy file1 to file3
http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/u_file.htm#i1003400

then do the above, but use file3 where I wrote file1.

Is this answer out of date? If it is, please let us know via a Comment