Last Wednesday I selected data from an HTML table : select from xml
Today, let’s try the opposite, generate an HTML table from a SQL query
select
XMLSERIALIZE(
DOCUMENT
XMLROOT(
XMLTRANSFORM(
XMLTYPE(
CURSOR(
SELECT * FROM DEPT
)
),
XMLTYPE.CREATEXML(
'
Table DEPT in HTML format
DEPTNO | DNAME | LOC |
---|---|---|
'
)
)
, VERSION '1.0')
)
from DUAL;
Table DEPT in HTML format
DEPTNO | DNAME | LOC |
---|---|---|
10 | ACCOUNTING | NEW YORK |
20 | RESEARCH | DALLAS |
30 | SALES | CHICAGO |
40 | OPERATIONS | BOSTON |
Largely inspired from xmlfiles.com
Pingback: Laurent Schneider » Blog Archive » select in HTML format, XQUERY variant
Wow, that was easy! 😉
Laurent, what about:
>set markup html on
>select * from emp;
sure, if you are using sqlplus 🙂