Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Column data in multiple rows when wrote to text/excel file

asim cholasNov 29 2017 — edited Nov 30 2017

Hello Experts,

We have a strange issue when we write the data to a text file. Data file contains two rows for each record just like the way it is displayed in DB.

But when we manually export it from the toad it is coming in one line. we need it to be in one line as the data file is a feed for another system.

Create or replace PROCEDURE Test

IS

xfile UTL_FILE.file_type;

BEGIN

xfile := UTL_FILE.fopen ('IT_BI', 'Test_DAILY_New.txt', 'W');

FOR c IN

(SELECT 'ID_NUMBER'||'**'||'RECVFromAddress' x_file

        FROM DUAL

------------------------------------------

UNION ALL

------------------------------------------

SELECT DISTINCT ID_Number||'**'||RECVFromAddress

                 FROM Test\_Table                                          

)

LOOP

UTL_FILE.put_line (xfile, c.x_file);

END LOOP;

UTL_FILE.fclose (xfile);

END ;

pastedImage_1.png

London Finance House London should be in one line in the file . Instead it is coming down as two lines.

Data viewed from Toad has also two lines.

pastedImage_3.png

Thank you all,

This post has been answered by asim cholas on Nov 30 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2017
Added on Nov 29 2017
20 comments
2,588 views