Hi all,
First of all let me admit that I have hardly any SQL knowledge, so I might be making very silly mistakes ;-)
I've configured some triggers (with the help of some templates etc.), which will insert a record in a table with events, as soon as a record is inserted/updated. The event-table will be used by an external process to synchronise data.
This works and I've tested it extensively.
Now the only thing I require is a statement that will be used only once, to start the initial synchronisation . I want to select all records in a table, and for each record, I want to insert a record into my event-table. If I can run it from Toad, it'll be more than sufficient.
This is what I have come up with:
[code=oracle]
CURSOR c is SELECT * FROM prig_own.dpic30 0;
BEGIN
FOR r IN c LOOP
INSERT INTO idmdirect.event _process
(
record_id,
table_key,
event_type,
event_time,
table_name
)
VALUES
(
idmdirect.seq_l og_record_id.ne xtval,
('pk_Dienstverb andID=' || REPLACE(r.objec t_ID,' ', '')),
6,
sysdate,
'view_dienstver band'
);
END LOOP;
COMMIT;
END;
[/code]
I'm getting bombarded with "invalid syntax" and errors stating that a different character is expect instead of c (my cursor)
This is oracle 9i, which makes using FORALL and BULK COLLECTION impossible (I think?!)
Thx in advance!
Kind regards,
Kees
First of all let me admit that I have hardly any SQL knowledge, so I might be making very silly mistakes ;-)
I've configured some triggers (with the help of some templates etc.), which will insert a record in a table with events, as soon as a record is inserted/updated. The event-table will be used by an external process to synchronise data.
This works and I've tested it extensively.
Now the only thing I require is a statement that will be used only once, to start the initial synchronisation . I want to select all records in a table, and for each record, I want to insert a record into my event-table. If I can run it from Toad, it'll be more than sufficient.
This is what I have come up with:
[code=oracle]
CURSOR c is SELECT * FROM prig_own.dpic30 0;
BEGIN
FOR r IN c LOOP
INSERT INTO idmdirect.event _process
(
record_id,
table_key,
event_type,
event_time,
table_name
)
VALUES
(
idmdirect.seq_l og_record_id.ne xtval,
('pk_Dienstverb andID=' || REPLACE(r.objec t_ID,' ', '')),
6,
sysdate,
'view_dienstver band'
);
END LOOP;
COMMIT;
END;
[/code]
I'm getting bombarded with "invalid syntax" and errors stating that a different character is expect instead of c (my cursor)
This is oracle 9i, which makes using FORALL and BULK COLLECTION impossible (I think?!)
Thx in advance!
Kind regards,
Kees
Comment