Skip to content

alexeypustynnikov/html-table-from-sql-query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

HTML table from SQL query string

This function helps to create HTML table directly from SQL query.

In params:

1) sql_in -- SQL query string
2) table_width_prc -- Width of html table in %
3) head_bg_col -- Background colour in header, default '#FFFFFF' (white)
4) text_head_col -- Colour of text in header, default 'black'

Output:

1) HTML string 

Examples using default hr schema:

  1. White header, black text

    select create_html_table(q'[select * 
                               from hr.employees 
                               where rownum < 10]',30) from dual

    1

  2. White header, black text

    select create_html_table(q'[select first_name, hire_date from hr.employees 
                               where to_char(hire_date, 'YYYY') between 2002 and 2005 
                               order by hire_date]',30) from dual

    2

  3. Blue header, white text

    select create_html_table(q'[select manager_id, count(*) 
                                from hr.employees 
                                group by manager_id]', 30, '#4285E1', 'white') from dual

    3

  4. Green header, white text

    select create_html_table(q'[select job_id, avg(salary) as "avg salary" 
                                from hr.employees 
                                group by job_id 
                                having avg(salary)>10000]', 30, '#27ae60', 'white') from dual

    4

About

One can get html table from sql query string

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages