title: Generate test data in Oracle tables
body: <p>I want to create test data for these Oracle tables:</p>
  
  <pre><code>CREATE TABLE AGENT_HISTORY(
    EVENT_ID INTEGER NOT NULL,
    AGENTID INTEGER NOT NULL,
    EVENT_DATE DATE NOT NULL
  )
  /
  
  CREATE TABLE CPU_HISTORY(
    CPU_HISTORY_ID INTEGER NOT NULL,
    EVENT_ID INTEGER NOT NULL,
    CPU_NAME VARCHAR2(50 ) NOT NULL,
    CPU_VALUE NUMBER NOT NULL
  )
  /
  </code></pre>
  
  <p>Can you help me to create procedure for generating random values for 100 rows?</p>
  
  <p>I tried this </p>
  
  <pre><code>BEGIN
  
    FOR loop_counter IN 1..1000
    LOOP
      INSERT INTO AGENT_HISTORY (EVENT_ID, AGENTID, EVENT_DATE)
      VALUES (loop_counter, 22, SYSDATE);
    END LOOP;
  
    COMMIT;   
  
    FOR loop_counter IN 1..1000
    LOOP
      INSERT INTO CPU_HISTORY_ID (CPU_HISTORY_ID, EVENT_ID, CPU_NAME, CPU_VALUE)
      VALUES (loop_counter, loop_counter, 'cpu1', dbms_random.value(1,100));
    END LOOP;
  
    COMMIT;
  END;
  </code></pre>
  
  <p>But I get these errors:</p>
  
  <pre><code>Error report -
  ORA-00001: unique constraint (ADMIN.KEY8) violated
  ORA-06512: at line 5
  00001. 00000 -  "unique constraint (%s.%s) violated"
  *Cause:    An UPDATE or INSERT statement attempted to insert a duplicate key.
             For Trusted Oracle configured in DBMS MAC mode, you may see
             this message if a duplicate entry exists at a different level.
  *Action:   Either remove the unique restriction or do not insert the key.
  
  Error report -
  ORA-06550: line 5, column 16:
  PL/SQL: ORA-00942: table or view does not exist
  ORA-06550: line 5, column 4:
  PL/SQL: SQL Statement ignored
  06550. 00000 -  "line %s, column %s:\n%s"
  *Cause:    Usually a PL/SQL compilation error.
  *Action:
  </code></pre>