主要目的:
    用于快速创建一个随机数据的表 测试sql性能

    新建一张分区表

    1. create table test_part
    2. (
    3. no int,
    4. info varchar(20),
    5. startdate date
    6. )
    7. partition by range(STARTDATE) interval (numtodsinterval(7,'day'))
    8. (
    9. partition test_p1 values less than(to_date('2020/12/1','yyyy/mm/dd'))
    10. );

    批量插入

    1. 0,99999999之间的随机数据
    2. 10位的随机字符串
    3. 当前日期-9999和9999之间的随机日期
    declare
    temp int := 100;
    begin
    for i in 1..temp
    loop
    insert into test_part(no,info,startdate) values((DBMS_RANDOM.value(0,99999999)),dbms_random.string('x', 10),sysdate+DBMS_RANDOM.value(-9999,9999));
    if mod(i,10)=0 then
    commit;
    end if;
    end loop;
    commit;
    end;
    /