None

SQL Plus Producing HTML

February 26, 2010

I had a need to mock up some HTML from a database table for droplists to support a JavaScript training course I was writing. I did this using Oracle sql*plus and spooling an output file.

SQL> spool options.sql
SQL> select '<option value="' || make_serial || '">' || make_description || '</option>' from makes
...snip output...
SQL> spool off

This will create a file in the current directory called options.sql which will contain one line for each row from the table, in the correct format to be placed into the HTML. (after a little trimming in a text editor).

Tags: sql option select html