Powered by Blogger.

Oracle HTML output

Oracle HTML output


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
Category:Oracle
Date:2007-11-15
Level:Beginner
Product:See complete product
Viewed:35720

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:

Code:



  1.  



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



  3.  




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:

Code:



  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.

Share :

Facebook Twitter Google+
0 Komentar untuk "Oracle HTML output"

Back To Top