Skip to content

Instantly share code, notes, and snippets.

@64lines
Last active August 5, 2016 05:20
Show Gist options
  • Save 64lines/914a1b0d3a2e2f2afe3e to your computer and use it in GitHub Desktop.
Save 64lines/914a1b0d3a2e2f2afe3e to your computer and use it in GitHub Desktop.
-- Manual para 200000 inserts
BEGIN
FOR i IN 1..200000 LOOP
INSERT INTO CIUDAD VALUES(i, 'Ciudad ' || i);
COMMIT;
END LOOP;
END;
-- Bulk con 20000 inserts (Cargar en memoria y luego cargar en la tabla)
DECLARE
TYPE tytabla IS TABLE OF CIUDAD%ROWTYPE INDEX BY BINARY_INTEGER;
tbCiudad tytabla;
BEGIN
FOR i IN 1..200000 LOOP
tbCiudad(i).id_ciudad := i;
tbCiudad(i).nombre_ciudad := 'Ciudad ' || i;
END LOOP;
FORALL j IN 1..tbCiudad.COUNT
INSERT INTO CIUDAD VALUES tbCiudad(j);
END;
-- Borrar la tabla ciudad
TRUNCATE TABLE CIUDAD;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment