diff --git a/PKG_TABLE_TO_HTML.pkb b/PKG_TABLE_TO_HTML.pkb index bf4a89d..35fbba2 100644 --- a/PKG_TABLE_TO_HTML.pkb +++ b/PKG_TABLE_TO_HTML.pkb @@ -40,11 +40,18 @@ CREATE OR REPLACE PACKAGE BODY PKG_TABLE_TO_HTML AS * dbms_output.put_line(PKG_TABLE_TO_HTML.SQL_TO_HTML('SELECT EMPLOYEE_ID, FIRST_NAME || ' ' || LAST_NAME AS FULL_NAME FROM HR.EMPLOYEES','My header')); * END; *------------------------------------------------ +* DECLARE +* v_query SYS_REFCURSOR; +* +* BEGIN +* OPEN v_query FOR +* SELECT EMPLOYEE_ID, FIRST_NAME || ' ' || LAST_NAME AS FULL_NAME FROM HR.EMPLOYEES; +* +* dbms_output.put_line(PKG_TABLE_TO_HTML.REFCURSOR_TO_HTML(v_query,'My header')); +* END; +*------------------------------------------------ */ - -- week cursor for fetching row - TYPE refCur IS REF CURSOR; - -- get the cursor id and concatenate fetched row with separator or html table data tags FUNCTION CONCATENATE_ROW(i_CurNum INTEGER, v_separator VARCHAR2 @@ -257,7 +264,7 @@ CREATE OR REPLACE PACKAGE BODY PKG_TABLE_TO_HTML AS FUNCTION SQL_TO_HTML(v_SqlStatement VARCHAR2, clob_Message CLOB DEFAULT '') RETURN CLOB IS i_CurNum INTEGER; - curObj refCur; + curObj SYS_REFCURSOR; clob_Data CLOB := null; BEGIN OPEN curObj FOR v_SqlStatement; @@ -269,10 +276,25 @@ CREATE OR REPLACE PACKAGE BODY PKG_TABLE_TO_HTML AS RETURN clob_Data; END; + + FUNCTION REFCURSOR_TO_HTML(v_RefCursor IN OUT SYS_REFCURSOR, + clob_Message CLOB DEFAULT '') RETURN CLOB IS + i_CurNum INTEGER; + clob_Data CLOB := null; + BEGIN + i_CurNum := DBMS_SQL.to_cursor_number(v_RefCursor); + DEFINE_COLUMNS(i_CurNum); + clob_Data := CREATE_HTML(clob_Message, i_CurNum, '
', ''); + + RETURN clob_Data; + END; + + + FUNCTION ROW_TO_PIE_CHART_HTML(v_SqlStatement VARCHAR2, clob_Message CLOB DEFAULT '') RETURN CLOB IS i_CurNum INTEGER; - curObj refCur; + curObj SYS_REFCURSOR; clob_Data CLOB := null; clob_JsData CLOB := null; BEGIN diff --git a/PKG_TABLE_TO_HTML.pks b/PKG_TABLE_TO_HTML.pks index 940b7d1..32f1f53 100644 --- a/PKG_TABLE_TO_HTML.pks +++ b/PKG_TABLE_TO_HTML.pks @@ -24,12 +24,22 @@ CREATE OR REPLACE PACKAGE PKG_TABLE_TO_HTML AS * SOFTWARE. */ +/***************************************************************************** + REVISIONS: + Ver Date Author Description + --------- ---------- --------------- ------------------------------------ + x.1 31/05/2018 RBarata Added function REFCURSOR_TO_HTML +******************************************************************************/ + FUNCTION TABLE_TO_HTML(v_TableName VARCHAR2, clob_Message CLOB DEFAULT '') RETURN CLOB; FUNCTION SQL_TO_HTML(v_SqlStatement VARCHAR2, clob_Message CLOB DEFAULT '') RETURN CLOB; + FUNCTION REFCURSOR_TO_HTML(v_RefCursor IN OUT SYS_REFCURSOR, + clob_Message CLOB DEFAULT '') RETURN CLOB; + FUNCTION ROW_TO_PIE_CHART_HTML(v_SqlStatement VARCHAR2, clob_Message CLOB DEFAULT '') RETURN CLOB;