on-internet
← Community

How to generate .csv file from oracle table data?

Stack Overflow ·

I have generated a csv file using the below query, but all column data are coming in one column in the csv file. Please help me to separate these column data. create or replace procedure csv_generate as CURSOR c1 is SELECT * FROM emp; v1 c1%rowtype; z1 VARCHAR2(2000); z2 VARCHAR2(2000); f1 utl_file.file_type; BEGIN FOR i IN c1 loop --play(i.ename); f1:=utl_file.fopen('TEST_DIR1','out.dbf','W'); z1:=i.empno||' '||i.ename||' '||i.JOB||' '||i.sal||' '||i.deptno; z2:=z2||chr(10)||z1; utl_file.put_line(f1,z2); utl_file.fclose(f1); END loop; --utl_file.put_line(f1,z2); END;

Comments

Sign in or sign up to comment and upvote.

No comments yet.