1. 程式人生 > >快速生成測試資料指令碼

快速生成測試資料指令碼

create TABLE Test_Table as 
select 
	rownum id,
	floor(dbms_random.value(0,3))   sex,
	dbms_random.string('A',6)  name,
	111311198305100988 + floor(dbms_random.value(0,811311198305100988))  id_card,
	'0'||floor(dbms_random.value(1000000001,80000000000))  house_phone,
	10000000000 + floor(dbms_random.value(3111111111,3999999999))  mobile,
	'0'||floor(dbms_random.value(1000000001,80000000000))  fax,
	''||floor(dbms_random.value(100001,999999))  post_code,
	dbms_random.string('L',6)||'@'||dbms_random.string('L',4)||'.com'  email,
	floor(dbms_random.value(10000001,999999999))  qq,
	dbms_random.string('L',16)  addr,
	sysdate-floor(dbms_random.value(1,80))  birth_day, 
	floor(dbms_random.value(0,5))  occupation,
	floor(dbms_random.value(0,8))  fixed_assets,
	floor(dbms_random.value(0,3))  car_owner,
	sysdate-floor(dbms_random.value(1,60))  car_buy_time,
	dbms_random.string('L',5)  car_brand,
	dbms_random.string('L',5)  bui_name,
	floor(dbms_random.value(5,500))  car_price,
  floor(dbms_random.value(80,300))  bui_area_count,
  dbms_random.string('L',10)  bui_addr,
  ''||floor(dbms_random.value(100001,999999))  bui_post,
  dbms_random.string('L',10)  bui_manager,
  dbms_random.string('L',10)  bui_developer
from dual
connect by level <= 1000000;