1

Topic: Duplication of new records from one table in another.

Good afternoon!
Started to study Oracle, I can not  new records in any way.
For example:
In 1 new records are permanently added, it is necessary new to transfer these to the second table.
create or replace procedure SMS_GATE is
begin
FOR rec1 IN (SELECT * FROM table2 where SUBSTR (timesend, 1,8) = TO_CHAR (SYSDATE, ' YYYYMMDD ')) LOOP - daily records
FOR rec2 IN (select * from table1) LOOP - the table with new records
if (rec2.text! = rec1.text) then
insert into table1 (id, phone, text, timesend)
values (", rec1.phone, rec1.text, TO_CHAR (SYSDATE, ' YYYYMMDDHH24MISS'));
end if;
END LOOP;
END LOOP;
COMMIT;
end SMS_GATE;
The first time fulfills, and then starts records to increase and all the same old insert

2

Re: Duplication of new records from one table in another.

Dubovitsky;
Esteem about MERGE.
But it is better - describe completely solved task. And that can invent a curve bicycle...

3

Re: Duplication of new records from one table in another.

-2;
Let then  ....

4

Re: Duplication of new records from one table in another.

insert all?

5

Re: Duplication of new records from one table in another.

wrote:

where SUBSTR (timesend, 1,8) = TO_CHAR (SYSDATE, ' YYYYMMDD ')) LOOP - daily records

i.e. the data night disappear
Or you fulfill every second?