Sep 1, 2011

Transfer oracle data to excel

Sometime we have a requirement of viewing oracle table information in excel for further calculation. This can be achieved as shown in below example:

login into your oracle database as user scott



 SQL> set colsep ","  ---this is used for separating the columns with comma ","


 Set the line size and page size with the below commands


Transfer the information from excel to a text file (to your desired location) with the below spool command and then select the desired table query


below output will be generated to a text file

use spool off command, to stop transferring the information to a text file.

now you can exit from sqlplus and open new excel file

click "Data" and then click "From Text" from the top menu 
select the file you created previously and click on import
click "Delimited" the next screen and click "Next" button and select "Comma" in the Delimiters options and then click "Next" button and then "Finish" button



hope this will help you to see your desired results


No comments:

Post a Comment