Hpw can I recreate a table with PL/SQL
Cause and prerequisitesBad table
SolutionPrerequisite:
A second table with the same structure must be availible.
DECLARE
CURSOR my_cursor IS
SELECT mandt, relid, srtfd, srtf2,
loekz ,sperr, aedat, usera, pgmid,begdt,enddt,clustr,clustd
FROM agdb;
my_rec my_cursor%ROWTYPE;
BEGIN
OPEN my_cursor;
LOOP
BEGIN
FETCH my_cursor INTO my_rec;
EXIT WHEN my_cursor%NOTFOUND;
INSERT INTO agdb1 VALUES (my_rec.mandt, my_rec.relid,
my_rec.srtfd, my_rec.srtf2,
my_rec.loekz, my_rec.sperr,
my_rec.aedat, my_rec.usera,
my_rec.pgmid, my_rec.begdt,
my_rec.enddt, my_rec.clustr,
my_rec.clustd);
EXCEPTION
when others then null;
END;
COMMIT; -- use this commit if you have a large table
END LOOP;
COMMIT; -- use this commit if you have a small table
CLOSE my_cursor;
END;
/
No comments:
Post a Comment