CREATE OR REPLACE PACKAGE BODY kscope_ptf AS
FUNCTION describe (p_tbl IN OUT DBMS_TF.TABLE_T )
RETURN DBMS_TF.DESCRIBE_T IS
BEGIN
FOR counter IN 1..p_tbl.column.count LOOP
p_tbl.column(counter).for_read := TRUE;
END LOOP;
RETURN NULL;
END;
/*--------------------------------------------------------*/
PROCEDURE fetch_rows IS
/*--------------------------------------------------------*/
v_rowset DBMS_TF.ROW_SET_T;
v_rowcount NUMBER;
v_colcount NUMBER;
BEGIN
DBMS_TF.GET_ROW_SET( rowset => v_rowset,
row_count => v_rowcount,
col_count => v_colcount);
DBMS_OUTPUT.PUT_LINE('*** ROW SET START ***');
DBMS_TF.TRACE( v_rowset );
DBMS_OUTPUT.PUT_LINE('*** ROW SET END ***');
DBMS_OUTPUT.PUT_LINE('-');
DBMS_OUTPUT.PUT_LINE('*** ROW SET COLUMNS START ***');
FOR ccounter IN 1..v_colcount LOOP
DBMS_OUTPUT.PUT_LINE('Column ' || ccounter);
DBMS_TF.TRACE( v_rowset(ccounter).description );
DBMS_OUTPUT.PUT_LINE('-- Values --');
DBMS_OUTPUT.PUT_LINE('ROW | TAB_NUMBER | TAB_VARCHAR2 | TAB_DATE |');
FOR rcounter IN 1..v_rowcount LOOP
DBMS_OUTPUT.PUT(rcounter);
IF v_rowset(ccounter).tab_number.COUNT > 0 THEN
DBMS_OUTPUT.PUT(' | ' || LPAD(v_rowset(ccounter).tab_number(rcounter) || ' |',13));
ELSE
DBMS_OUTPUT.PUT(' | Not Numeric | ');
END IF;
IF v_rowset(ccounter).tab_varchar2.COUNT > 0 THEN
DBMS_OUTPUT.PUT(RPAD(v_rowset(ccounter).tab_varchar2(rcounter),12,' ') || ' | ');
ELSE
DBMS_OUTPUT.PUT(' Not VC2 | ');
END IF;
IF v_rowset(ccounter).tab_date.COUNT > 0 THEN
DBMS_OUTPUT.PUT(v_rowset(ccounter).tab_date(rcounter));
ELSE
DBMS_OUTPUT.PUT('Not Date | ');
END IF;
/* --- and so on...
tab_date TAB_DATE_T,
tab_binary_float TAB_BINARY_FLOAT_T,
tab_binary_double TAB_BINARY_DOUBLE_T,
tab_raw TAB_RAW_T,
tab_char TAB_CHAR_T,
tab_clob TAB_CLOB_T,
tab_blob TAB_BLOB_T,
tab_timestamp TAB_TIMESTAMP_T,
tab_timestamp_tz TAB_TIMESTAMP_TZ_T,
tab_interval_ym TAB_INTERVAL_YM_T,
tab_interval_ds TAB_INTERVAL_DS_T,
tab_timestamp_ltz TAB_TIMESTAMP_LTZ_T,
tab_rowid TAB_ROWID_T);
*/
DBMS_OUTPUT.PUT_LINE('');
END LOOP;
END LOOP;
DBMS_OUTPUT.PUT_LINE('*** ROW SET COLUMNS END ***');
END;
END;