表:
create table emp2( id number, name nvarchar2(20), salary number(5), primary key(id));
充值:
begin for i in 1..10000 loop insert into emp2 values(i,dbms_random.string('*',dbms_random.value(6,20)),dbms_random.value(3000,99999)); end loop; commit; end; /
执行结果:
SQL> create table emp2( 2 id number, 3 name nvarchar2(20), 4 salary number(5), 5 primary key(id)); 表已创建。 SQL> begin 2 for i in 1..10000 loop 3 insert into emp2 values(i,dbms_random.string('*',dbms_random.value(6,20)),dbms_random.value(3000,99999)); 4 end loop; 5 6 commit; 7 8 end; 9 / PL/SQL 过程已成功完成。 SQL> select count(*) from emp2; COUNT(*) ---------- 10000 SQL> select avg(salary) from emp2; AVG(SALARY) ----------- 51678.82 SQL>
END