Home » SQL & PL/SQL » SQL & PL/SQL » Output to Excel in 2 different Cell (oracle 9.2.0.5)
Output to Excel in 2 different Cell [message #282337] Wed, 21 November 2007 10:00 Go to next message
feroze
Messages: 144
Registered: September 2005
Location: chicago
Senior Member
hi,
I want the output of .sql in a spread sheet in 2 different cells.Right now it's in 1 cell with this code.
set trim off
set heading off
spool C:\CNT_Query.sql
select 'select  ''' ||table_name ||''' , count(*) from '|| table_name ||';' from user_tables where partitioned='NO';
spool off


Then open C:\CNT.sql


set heading off
set trim off
spool c:\Table_count.xls
select  'ADDR' , count(*) from ADDR;
select  'ALRT' , count(*) from ALRT;
select  'ALRT_ADDL_RCPNT' , count(*) from ALRT_ADDL_RCPNT;
select  'ALRT_CD_TMP' , count(*) from ALRT_CD_TMP;
select  'ALRT_INBOX' , count(*) from ALRT_INBOX;
select  'ALRT_NOTE_TMP' , count(*) from ALRT_NOTE_TMP;
select  'ALRT_NTFY' , count(*) from ALRT_NTFY;
select  'ALRT_PYMT_TMP' , count(*) from ALRT_PYMT_TMP;
select  'ALRT_RTN_TMP' , count(*) from ALRT_RTN_TMP;
select  'ARC_REQ' , count(*) from ARC_REQ;
select  'ARC_REQ_TXN' , count(*) from ARC_REQ_TXN;
select  'ARC_REQ_TXN_IMG' , count(*) from ARC_REQ_TXN_IMG;
select  'ASSCN' , count(*) from ASSCN;
select  'BAD_PSWD' , count(*) from BAD_PSWD;
spool off


Now the output in Excel Sheet is :- ADDR 37112

Actually i want the output in excel 2 different Cells .

Hope i was able to clear the doubt.


Thanks

Re: Output to Excel in 2 different Cell [message #282339 is a reply to message #282337] Wed, 21 November 2007 10:20 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
Concatenate a comma "," with your output between the columns and save it as CSV (Comma Separated value)

HTH

Regards

Raj
icon14.gif  Re: Output to Excel in 2 different Cell [message #282345 is a reply to message #282339] Wed, 21 November 2007 10:58 Go to previous message
feroze
Messages: 144
Registered: September 2005
Location: chicago
Senior Member
Thanks Raj it worked.
Previous Topic: Which is better, returning a ref cursor or using out mode parameter in a function?
Next Topic: Error on buffer size
Goto Forum:
  


Current Time: Mon Dec 05 09:04:56 CST 2016

Total time taken to generate the page: 0.13116 seconds