Using HTML to Mark Up Your Data in Oracle SQL Developer


Looking at data can get tedious. Your eyes start to hurt. Your mind starts to wander. You start humming the theme song to The A-Team. Wouldn’t it be nice if the data you started your day with could be jazzed up a bit?

We’ve seen in an earlier post how you can use gauges and hyperlinks in your queries and grids. But maybe you didn’t realize that just plain jane HTML tags would also work.

Yes folks, you can get Comic Sans MS in your grids.

Here’s an example:
WHEN E.Salary >5000
THEN ‘<html><strong><font color="red" face="Comic Sans MS" size=5>’
ELSE ‘<html><font color="blue">’
END First_Name,
last_name, ‘<html><font color="green" size =3>’ || salary ||'</font></html>’ SALARY
hr.employees e;

Running this in a SQL Developer worksheet with F9 or ctrl+enter will produce output that looks like this:

Punch it up a bit!

So what else can it render? Let’s find out!

select ‘<HTML><li>My Data</li></html>’ MoreFunStuff from dual
select ‘<HTML><img src="" height=23 width=134></HTML>’ MoreFunStuff from dual
select ‘<HTML><table cols="3" border=2><th>Tables</th><th>Inside of</th><th>Tables</th></table></HTML>’ MoreFunStuff from dual;

Images, bullets, and table tags – oh my!

What’s This Really Good For Though?

This might fall more on the trick side of the tip vs trick scale. But, if you get creative with reports like @ba6dotus has done here with a Log Switch Frequency Map, then I think you might see some true potential with this.

Don’t Forget to Permanently Save These For Later

After you’ve built a few of these, save them as Snippets. Select the code, right click, ‘Save as Snippet…’ Use the ‘Custom’ category, then you can recall them on demand and not have to worry about pulling them from your SQL History list.

Related Posts Plugin for WordPress, Blogger...

Similar Posts by Content Area: , , ,