Thursday, July 26, 2012

How to fectch SQL Plus results to file

Fetching SQL Plus results to a file and that too in a good HTML format is very easy with following steps..try it
1. Login to SQL Plus, you will be able to see 'SQL>' on screen.

2. Type following command and hit 'Enter' button
SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF;
After this, you will be able to see 'SQL>' on screen.

3. Type following command and hit 'Enter' button (Please ensure to give the correct
path on drive)
SPOOL $DRIVE_PATH_TO_STORE_OUTPUT_FILE/Result.xls;

4. Next step is to type your query and hit 'Enter' button (e.g. select * from table_name;)

5. After script is done, type following and hit 'Enter' button.
SPOOL OFF;

6. Type following command and hit 'Enter' button
set markup html off;

7. You will be able to see the 'SQL>' on screen.

Go to $DRIVE_PATH_TO_STORE_OUTPUT_FILE path where the result file is stored and
verify the results.

Nice formatted results ..huh ?

No comments:

SpringBoot: Features: SpringApplication

Below are a few SpringBoot features corresponding to SpringApplication StartUp Logging ·          To add additional logging during startup...