Due to stupid legacy system limitations I am trying to write the following query using one single statement:
insert into dbo.mytable_archive
select *
from dbo.mytable
where date < trunc(sysdate) - 14;
delete from dbo.mytable
where date < trunc(sysdate) - 14;
Using the power of Google I find that this seems possible in many other databases using the RETURNING
clause i Postgres or OUTPUT
clause in SQLServer but I am unable to find an equivalent solution for Oracle (V12).
Any idea for a workaround?