oracledba.help
SpecialTopics

Test Data Creation

Overview

Edit then run the following to create test data to your liking.

 -- This query creates a table with 100,000 rows of random data.
 CREATE TABLE test42.test_table AS
 SELECT LEVEL id, 
        SYSDATE+DBMS_RANDOM.VALUE(-1000, 1000) date_value, 
        DBMS_RANDOM.string('A', 20) text_value
 FROM dual
 CONNECT BY LEVEL <= 100000;

 SELECT count(*) FROM test42.test_table;

 -- DROP Table When Done
 DROP TABLE  test42.test_table;

Test Schema and Data Creation Session

CREATE USER scott IDENTIFIED BY "tiger" 
  DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;

GRANT connect,resource,dba TO scott;

SELECT user_id,username,password,account_status,
       default_tablespace,temporary_tablespace
FROM dba_users ORDER BY username;

CREATE TABLE scott.test1 AS SELECT LEVEL id, 
  SYSDATE+DBMS_RANDOM.VALUE(-1000, 1000) date_value, 
  DBMS_RANDOM.string('A', 20) text_value 
  FROM dual CONNECT BY LEVEL <= 100000;

SELECT COUNT(*) from scott.test1;

DROP TABLE scott.test1;