Re: insert statement using order by
From: jarichter <jarichter2_at_freezone.co.uk>
Date: 1999/10/12
Message-ID: <380393d0.0_at_news1>#1/1
END LOOP;
END;
/
Date: 1999/10/12
Message-ID: <380393d0.0_at_news1>#1/1
DECLARE
commit_counter PLS_INTEGER (3) :=0;
CURSOR get_em IS
SELECT *
FROM othertable
ORDER BY desc;
BEGIN
FOR ins_rows IN get_em
LOOP
INSERT INTO table_name VALUES (ins_rows.col1, ins_rows.col2); IF commit_counter > 500 THEN COMMIT; commit_counter :=0; ELSE commit_counter := commit_counter +1; END IF;
END LOOP;
END;
/
However, after this you will need to rebuild any indexes on the table because they will be severly unbalanced and thus slow.
Regards,
Jack
Received on Tue Oct 12 1999 - 00:00:00 CEST