Hi,
I have 2 tables:
create table TABLE1
(
CI_ID NUMBER(20,0) not null,
SPID NUMBER(20,0) not null,
C_DTM TIMESTAMP not null
)
create table TABLE2
(
CIDES_ID NUMBER(20,0) not null,
CI_ID NUMBER(20,0) not null,
SPID NUMBER(20,0),
C_DTM TIMESTAMP
)
30 days ago I added SPID and C_DTM to TABLE2 and now I need to populate them from the values in TABLE1
So far I've got the following but I have millions of rows per day and I want to do them day by day which I can manage for example like I have below for all records older than 29 days, but inside a particular day I want to batch it to update it by 1000 records a time and then commit.
Any suggestions on how I can batch the statement below?
UPDATE TABLE2 CIDES
SET (C_DTM, SPID) = (SELECT CID.C_DTM, CID.SPID
FROM TABLE1 CID
WHERE CIDES.CI_ID = CID.CI_ID)
WHERE EXISTS (
SELECT 1
FROM TABLE1 CID
WHERE CIDES.CI_ID = CID.CI_ID
and CID.C_DTM < (sys_extract_utc(current_timestamp) - 20));
Thanks