先测试独立一张表的更新时间sql 可用不可用
select max(ora_rowscn), to_char( scn_to_timestamp(nvl(max(ora_rowscn),1002267)),'yyyy-mm-dd hh24:mi:ss') from DM00_HSBM8 t;
select max(ora_rowscn), to_char( scn_to_timestamp(nvl(max(ora_rowscn),1002267)),'yyyy-mm-dd hh24:mi:ss') from 表名 t;
测试成功后,执行如下语句,得到Oracle所有表的 更新语句sql。
select 'select ''' || t.TABLE_NAME || ''' table_name, to_char(scn_to_timestamp(nvl(max(ora_rowscn),1002267)),''yyyy-mm-dd hh24:mi:ss'') updateTime from ' || t.TABLE_NAME || ' union all' from user_tables t order by t.TABLE_NAME;
图片.png
最后直接把所有语句粘出来,然后在外面来一层select
select table_name, updateTime from
(select 'DM00_DPXZ' table_name, to_char(scn_to_timestamp(nvl(max(ora_rowscn),1002267)),'yyyy-mm- dd hh24:mi:ss') updateTime from DM00_DPXZ union all
select 'XSTJ_SA_SAWP' table_name, to_char(scn_to_timestamp(nvl(max(ora_rowscn),1002267)),'yyyy- mm-dd hh24:mi:ss') updateTime from XSTJ_SA_SAWP union all
select 'XSTJ_SA_WP' table_name, to_char(scn_to_timestamp(nvl(max(ora_rowscn),1002267)),'yyyy-mm-dd hh24:mi:ss') updateTime from XSTJ_SA_WP)a order by updateTime desc
网友评论