after that i need to pipe row compared values How we can compare values of single column in PLSQL table using loop? After that I need to Pipe row compared values. Record:
type rec is record (tab_value varchar2(4000),
trn_date date);
V_REC REC;
--table
type tab is table of rec;
V_TAB TAB;
-- variable
v_query(4000);
-- defining cursor
TYPE CUR IS REF CURSOR;
V_CUR CUR;
-- query
-- MASTER TABLE
v_query := ' SELECT D.DESCRIPTION AS TAB_VALUE,--column on which dml performs
D.TRN_DATE
FROM TEST.TABLE D
WHERE 1 = 1 '||
' UNION
SELECT D.DESCRIPTION AS TAB_VALUE,-- column which stores old value of master table
D.NEW_TRN_DATE AS TRN_DATE
FROM TEST.SYN_TABLE D
WHERE 1 = 1 ';
When DML is performed on description column (D.DESCRIPTION) of master table then recent value of master table ---stored in history table
--opening cursor
OPEN V_CUR_HIST FOR V_QUERY;
-- loop started
LOOP
FETCH V_CUR
INTO V_REC;
EXIT WHEN V_CUR_HIST%NOTFOUND;
V_TAB(V_INDEX).TAB_VALUE := V_REC.TAB_VALUE;--contains value of master & history table
V_TAB(V_INDEX).TRN_DATE := V_REC.TRN_DATE;
--adding increment in v_index
V_INDEX := V_INDEX + 1;
END LOOP;
Now what I require is data comparison of master value and history table value in form of output like this:
old_value(history table value) new_value(master table value)
a
a b
b c
c d