How do I exclude unchanged fields in Flashback query resultset?
-
08-03-2021 - |
Вопрос
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 ?
Решение
Is there a way to excluded unchanged fields from versioned response?
Not really.
Flashback uses the information found in UNDO
. Flashback Data Archive stores the results from the Log files in a table.
So, you get ALL of the data when you do a Flashback query.
The common method is to use LAG
+ DECODE
. But, I'm afraid that this will problematic for your LOB
columns.
Personally, I'd pawn off the problem to the UI (Display Tier).