how to retrieve data from different tables ,place this data in different excel worksheets.

Answer Posted / mahesh_ch

declare
cursor c1 is select e.empno,e.ename,e.sal,e.deptno,d.deptno dno,d.dname,d.loc from emp e,dept d where e.deptno=d.deptno;
fp utl_file.file_type;
cfilename varchar2(20);
begin
cfilename:='office'||to_char(to_date('2007','yyyy'),'yyyy')||'.xls'; /*specifying filename*/
fp:=utl_file.fopen('DATA_PUMP_DIR',cfilename,'w'); /*DATA_PUMP_DIR is a default directory*/
for i in c1 loop
UTL_FILE.PUT_LINE(fp,i.empno||i.ename||i.sal||i.deptno);
end loop;
utl_file.fclose(fp);
end;

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the best way to do multi-row insert in oracle?

562


What is background process in Oracle?

626


What is oracle server autotrace in oracle?

614


Please explain oracle left join with an example?

583


What is java oracle used for?

523






How to define a sub function?

664


Can we create trigger on materialized view in oracle?

565


How to create a table in a specific tablespace?

543


How do I uninstall oracle 11g?

558


What are the predefined tablespaces in a database?

554


How to login to the server without an instance?

620


How do I find my oracle client driver version?

527


What is truncate oracle?

530


What is Java Pool in Oracle?

602


How can we delete duplicate rows in a table?

564