Guest_imported
New member
- Jan 1, 1970
- 0
I have this code:
DECLARE
CURSOR c1 IS SELECT * FROM golf_denorm;
BEGIN
FOR rec IN c1
LOOP
-- Populate master table
INSERT INTO golf_norm VALUES (rec.game_num, rec.player_id);
-- Populate child table (1 row for each hole in denorm tab)
INSERT INTO golf_norm_holes VALUES (rec.game_num, 1, rec.hole1_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 2, rec.hole2_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 3, rec.hole3_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 4, rec.hole4_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 5, rec.hole5_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 6, rec.hole6_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 7, rec.hole7_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 8, rec.hole8_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 9, rec.hole9_score);
END LOOP;
END;
The problem with is I am told that when I try doing this
insert, data becomes too large and insert fails.
I need to do ocassional commits.
Looking at this code, can anyone tell me how to modify this
code to make it commit after say 10 inserts.
Any new code would be greatly appreciated.
Snead.
DECLARE
CURSOR c1 IS SELECT * FROM golf_denorm;
BEGIN
FOR rec IN c1
LOOP
-- Populate master table
INSERT INTO golf_norm VALUES (rec.game_num, rec.player_id);
-- Populate child table (1 row for each hole in denorm tab)
INSERT INTO golf_norm_holes VALUES (rec.game_num, 1, rec.hole1_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 2, rec.hole2_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 3, rec.hole3_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 4, rec.hole4_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 5, rec.hole5_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 6, rec.hole6_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 7, rec.hole7_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 8, rec.hole8_score);
INSERT INTO golf_norm_holes VALUES (rec.game_num, 9, rec.hole9_score);
END LOOP;
END;
The problem with is I am told that when I try doing this
insert, data becomes too large and insert fails.
I need to do ocassional commits.
Looking at this code, can anyone tell me how to modify this
code to make it commit after say 10 inserts.
Any new code would be greatly appreciated.
Snead.