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

Why do we use coalesce function in oracle?

627


Can we create trigger on materialized view in oracle?

563


How to empty your oracle recycle bin?

568


What to do if dba lost the system password?

594


How to loop through data rows in the implicit cursor?

539






Differentiate between pre-select and pre-query?

616


How many objectname will be created for a single table drop function? Why 'flashback' query giving error "ORA-38312: original name is used by an existing object" while getting the table?

1802


How to initialize variables with default values?

634


How do we represent comments in oracle?

627


Design database draw er diagram for a certain scenario ?

4099


What are the differences between char and nchar in oracle?

593


What is the difference between primary key and unique key and foreign key in oracle?

544


Can we convert a date to char in oracle and if so, what would be the syntax?

548


How to estimate disk space needed for an export job?

558


How do I reset a sequence in oracle?

592