Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle sqlplus HTML report - alternating rows color

I use Oracle sqlplus "set markup html on" to quickly convert query output into HTML report -

It's very simlpe way to publish database report online.

I'm missing however one thing - alternating colors for every other row, This is especially helpful while viewing wide reports.

is there any way to embed HTML color for every row, like make it dependent on mod(rownum/2) - even/odd row number ?

thank you !

like image 504
dovka Avatar asked Mar 22 '26 20:03

dovka


1 Answers

I don't think there is, using SET MARKUP HTML ON. You would have to write your own markup something like:

select '<tr style="color:' 
       || CASE mod(rownum,2) WHEN 0 THEN 'red' ELSE 'green' END
       || '"><td>' || ename || '</td></tr>' data
from 
( select ename from emp order by ename );

Then add the surrounding table tags using PROMPTs or whatever.

like image 159
Tony Andrews Avatar answered Mar 25 '26 10:03

Tony Andrews



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!