Use execute immediate to insert random numbers
SQL>
SQL> create table t( c1 int, c2 int, c3 int, c4 int ) storage ( freelists 10 );
Table created.
SQL>
SQL>
SQL> declare
2 myNumber number;
3 begin
4 for i in 1 .. 10
5 loop
6 myNumber := dbms_random.random;
7
8 execute immediate
9 'insert into t values ( ' || myNumber || ',' ||
10 myNumber || ',' ||
11 myNumber || ',' ||
12 myNumber || ')';
13 end loop;
14 commit;
15 end;
16 /
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL> select * from t;
C1 C2 C3 C4
---------- ---------- ---------- ----------
-934884549 -934884549 -934884549 -934884549
1258621996 1258621996 1258621996 1258621996
-739854461 -739854461 -739854461 -739854461
-2.077E+09 -2.077E+09 -2.077E+09 -2.077E+09
286830488 286830488 286830488 286830488
-1.128E+09 -1.128E+09 -1.128E+09 -1.128E+09
1345837309 1345837309 1345837309 1345837309
87152190 87152190 87152190 87152190
561507416 561507416 561507416 561507416
-2.139E+09 -2.139E+09 -2.139E+09 -2.139E+09
10 rows selected.
SQL>
SQL>
SQL> drop table t;
Table dropped.
SQL>
SQL> --
Related examples in the same category