There is a table named t_state, I created a snapshot log for it (see below). I'd like to know what the column change_vector$$ is.
SQLWKS> desc MLOG$_T_STATE
Column Name Null? Type
------------------------------ -------- ----
COUNTRY VARCHAR2(3)
STATE VARCHAR2(4)
SNAPTIME$$ DATE
DMLTYPE$$ VARCHAR2(1)
OLD_NEW$$ VARCHAR2(1)
CHANGE_VECTOR$$ RAW(255)
--------------
What I did here is insert a row and then update it.
SQLWKS> select * from MLOG$_T_STATE
2>
COU STAT SNAPTIME$ D O CHANGE_VECTOR$$
tst MF 01-JAN-00 I N FE
tst MF 01-JAN-00 D O 00
tst MR 01-JAN-00 I N FF
3 rows selected.
Thanks
It is a change vector describing what columns have been modified. The size of the vector is a function of the number of columns. If you goto:
</code>
http://asktom.oracle.com/~tkyte/hexdec/index.html <code>
I have a base conversion routine there, usful for dumping the binary format of the vector.
consider this example. I update each column in turn and fetch out the vector and display it. It can be used to see which columns were updated:
ops$tkyte@DEV816> create table t
2 ( x int primary key,
3 c0 int, c1 int, c2 int, c3 int, c4 int,
4 c5 int, c6 int, c7 int, c8 int, c9 int,
5 c10 int, c11 int, c12 int, c13 int, c14 int,
6 c15 int, c16 int, c17 int, c18 int, c19 int );
Table created.
ops$tkyte@DEV816>
ops$tkyte@DEV816> insert into t(x) values ( 1);
1 row created.
ops$tkyte@DEV816>
ops$tkyte@DEV816> create snapshot log on t;
Materialized view log created.
ops$tkyte@DEV816> set serveroutput on format wrapped;
ops$tkyte@DEV816> declare
2 l_str varchar2(255);
3 begin
4 for i in 0 .. 19
5 loop
6 execute immediate
7 'update t set c' || i || ' = 1';
8
9 select change_vector$$ into l_str
10 from mlog$_t;
11
12 dbms_output.put_line
13 ( to_char(i,'99') || ' = ' || l_str || ' ' ||
14 lpad(to_bin( to_number(l_str,'xxxxxx') ),32,'0') );
15 delete from mlog$_t;
16 end loop;
17 update t set c1 = 2, c4 = 3, c10 = 12, c11 = 2, c18=0;
18 select change_vector$$ into l_str
19 from mlog$_t;
20
21 dbms_output.put_line
22 ( to_char(0,'99') || ' = ' || l_str || ' ' ||
23 lpad(to_bin( to_number(l_str,'xxxxxx') ),32,'0') );
24 end;
25 /
0 = 040000 00000000000001000000000000000000
1 = 080000 00000000000010000000000000000000
2 = 100000 00000000000100000000000000000000
3 = 200000 00000000001000000000000000000000
4 = 400000 00000000010000000000000000000000
5 = 800000 00000000100000000000000000000000
6 = 000100 00000000000000000000000100000000
7 = 000200 00000000000000000000001000000000
8 = 000400 00000000000000000000010000000000
9 = 000800 00000000000000000000100000000000
10 = 001000 00000000000000000001000000000000
11 = 002000 00000000000000000010000000000000
12 = 004000 00000000000000000100000000000000
13 = 008000 00000000000000001000000000000000
14 = 000001 00000000000000000000000000000001
15 = 000002 00000000000000000000000000000010
16 = 000004 00000000000000000000000000000100
17 = 000008 00000000000000000000000000001000
18 = 000010 00000000000000000000000000010000
19 = 000020 00000000000000000000000000100000
0 = 483010 00000000010010000011000000010000
PL/SQL procedure successfully completed.