Is it possible to exclude unchanged fields in Flashback query resultset?
Consider I have following table
create table first_table
(
id int generated as identity,
name NVARCHAR2(1024),
age smallint,
notebook nclob,
userpic clob,
salary float
)
If the table has very frequent updates (e.g. on notebook
field) following versioned query
select ROWID, VERSIONS_OPERATION, VERSIONS_STARTSCN, VERSIONS_STARTTIME, VERSIONS_XID, id, name, age, notebook, userpic, salary
from FIRST_TABLE versions between scn 1469193 and 1482882;
will pull heavy userpic value for every row even though it's the same.
Can I somehow avoid that and instead get NULLs for unchanged values ?
You can use
LAG()
Analytic Function in order to compare a column's value for the current row with the previous row. So, pick any column's value unmatched its value of LAG to display only the changes while keeping others NULL as