执行此操作的一个选项可能是数据库触发器 - 与您对表所做的审计 更改非常相似。例如(基于 Scott 的模式):
SQL> alter session set nls_date_format = 'dd.mm.yyyy hh24:mi:ss';
Session altered.
SQL> create table dept_audit as select * from dept where 1 = 2;
Table created.
SQL> alter table dept_audit add datum date;
Table altered.
SQL> create or replace trigger trg_bu_dept
2 after update on dept
3 for each row
4 begin
5 insert into dept_audit (deptno, dname, loc, datum)
6 values (:new.deptno, :new.dname, :new.loc, sysdate);
7 end;
8 /
Trigger created.
SQL> update dept set loc = 'Dallas' where deptno = 20;
1 row updated.
SQL> select * from dept_audit;
DEPTNO DNAME LOC DATUM
---------- -------------- ------------- -------------------
20 RESEARCH Dallas 05.11.2018 08:19:06
SQL>
所以,您只需要 UPDATE 行;触发器会将它们“复制”到另一个表中。这并不是您在问题中提到的严格意义上的“一个查询”,但 - 希望 - 能够达到目的。