Oracle HTML output

Home - Tutorials - Oracle

In this small tutorial I will show you how you can display the output of the select command in a formatted HTML table from sqlPlus.

Tutorial info:

Name:Oracle HTML output
Total steps:1
Product:See complete product

Bookmark Oracle HTML output

AddThis Social Bookmark Button

Step 1 - HTML output from sqlPlus

Oracle HTML output

Oracle is a very feature rich high end database, however sqlPlus is one of it's weakness. Time to time it you need to list the content of a table or view in Oracle using sqlPlus and it usually results a hard interpretable output. There is the possibility to set line size parameter and modify the display size of the columns but it takes to much time. 

I nice solution would be to display the output in a HTML format. Fortunately we can do that. Now I will show you 2 solutions. The first one is working from the command line and the second one is working inside sqlPLus.

1. Generate Oracle HTML output from command line:

  2. sqlplus -S -M "HTML ON TABLE 'BORDER="2"'" user/password @test.sql>test.html

In this example you need to create the test.sql file and put all your sql statements in this file. The result will be written into the test.html file.

2. Generate Oracle HTML output inside sqlPlus:

  1. SET markup HTML on
  2. spool test.html
  3. SELECT * FROM mytable;
  4. spool off
  5. SET markup HTML off

In this case you can write all of your sql statements between the spool commands. The test.html file will be generated in the actual directory.

As you can see these solutions are not the best as you can view the files in a browser and not in sqlPlus, however in a lot of cases this solution makes your life easier.

Tags: oracle html output, orache sqlplus html, sqlpus html output, oracle sqlplus select output

Oracle HTML output - Table of contents
Step 1 - HTML output from sqlPlus

F1 Site Family
Database F1
Java F1
JavaScript F1

Family tutorials
PHP Array
PHP Redirect
PHP Session
JavaScript String
JavaScript Timeout
JavaScript Tooltip
AJAX File Upload
AJAX Rating System

Total time: 0.0116