Code (SQL)
[sql]
create or replace PROCEDURE insert_product
AS
iprodid NUMBER;
i NUMBER;
j NUMBER;
PROMOCODE product.PROMOCODE%TYPE;
BEGIN
FOR i IN 1..3 LOOP
iprodid := i * 1000;
SELECT DECODE (i, 1, 'A',
2, 'B',
3, 'C') INTO PROMOCODE
FROM DUAL;
FOR j IN 1..1000 LOOP
INSERT INTO PRODUCT (PRODID, PROMOCODE, DESCRIP) VALUES (iprodid+j, PROMOCODE, dbms_random.string ('U', 5));
END LOOP;
END LOOP;
COMMIT;
END;
TRUNCATE TABLE PRODUCT;
SELECT * FROM PRODUCT;