UTL_FILE.PUT_LINE from two scripts

Hi Experts, I have a main script:

Open in new window

(see atachment)
This script generates:

Open in new window

with the data to pass to another 2 scripts:
@ 01_puntos_5min.sql 008
@ 02_estaciones.sql 008
@ 01_puntos_5min.sql 009
@ 02_estaciones.sql 009

Open in new window

008, 009

Open in new window

are the values obtained from the main cursor.
I hope to get in each case, one text file:

Open in new window

Each separate works OK, but when you run them in the same script, the text files are generated only for one of the 009 variables, missing lines 008 value.
This missing a step or loop?, Maybe you can help me diagnose the error.
Thanks in advanced
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
You don't show the code with UTL_FILE in it.

My guess is you just do a normal open on the file which does an open-truncate.

You likely want and open-append.

In the FOPEN use an 'a'.

slightwv (䄆 Netminder) Commented:
>>You don't show the code with UTL_FILE in it.

Guess you were adding them as I was typing...

That is it:
UTL_FILE.FOPEN('DATOS', 'puntos.txt', 'W');

Should be:
UTL_FILE.FOPEN('DATOS', 'puntos.txt', 'A');

You just need to make sure the SHELL script removes the file first or you will just keep appending to it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
carlino70Author Commented:
It works. Excellent Mr!

Thanks for the solution and the recomendation!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.