ORACLE快速创建百万测试数据
程序员文章站
2022-06-21 10:37:36
1.sql语句INSERT INTO act_result_log(onlineSeqId,businessId,becifNo,ivisResult,createdBy,createdDate,updateBy,updatedDate,riskLevel)SELECT dbms_random.string('x',31) AS onlineSeqId,(CASE MOD(ABS(dbms_random.random),10) WHEN 1 THEN 'UP_UM_UD' WH...
1.sql语句
INSERT INTO act_result_log(
onlineSeqId,
businessId,
becifNo,
ivisResult,
createdBy,
createdDate,
updateBy,
updatedDate,
riskLevel
)
SELECT dbms_random.string('x',31) AS onlineSeqId,
(CASE MOD(ABS(dbms_random.random),10) WHEN 1 THEN 'UP_UM_UD' WHEN 2 THEN 'IM_UP_IU' ELSE 'DM_IK_KL' END) AS businessId,
(CASE MOD(ABS(dbms_random.random),10) WHEN 1 THEN '10008611' WHEN 2 THEN '10111111' ELSE '6666666' END) AS becifNo,
(CASE MOD(ABS(dbms_random.random),10) WHEN 1 THEN '0' WHEN 2 THEN '1' ELSE '2' END) AS ivisResult,
'sys' AS createdBy,
SYSDATE AS createdDate,
'sys' AS updateBy,
SYSDATE AS updatedDate,
(CASE MOD(ABS(dbms_random.random),10) WHEN 1 THEN 'R1' WHEN 2 THEN 'P1' ELSE 'O1') AS riskLevel
form DUAL connect BY LEVEL <= 1000000;
100万的测试数据只需要2分50秒搞定
本文地址:https://blog.csdn.net/LuckFairyLuckBaby/article/details/107644023