Reputation: 1616
I have this Oracle table. For development purposes I want to generate 10,000 different values into the table. How I can do this?
CREATE TABLE ERRORLOG(
ERRORID INTEGER NOT NULL,
ERRORCONTENT CLOB NOT NULL,
ERRORDATE TIMESTAMP(6) NOT NULL
)
Upvotes: 1
Views: 799
Reputation: 6526
The easiest way to generate data is by using other database applications like TOAD. check the bellow pic.
Upvotes: 1
Reputation: 3038
If you are looking for just something chaotic in CLOB (including length and content) you may use DBMS_RANDOM:
SQL> select DBMS_RANDOM.STRING('p',DBMS_RANDOM.VALUE(1,30)) rand_str from dual connect by level <= 10
2 /
RAND_STR
--------------------------------------------------------------------------------
#<a
tV&Og8=:f}Is/sR2L>F\7wCL)_V2
/WBp Y)V5ZD.v
_yw(o_
b:5&E}7\a1Gt]X}$}e*-W[6U=1
L<hQ:L^5}A(]<:}+8|-{.F%&`L
G!L'Rbgiw/o]r~`[@9d6FUi3dc7
.h_y;yeh`*rUK+\~8^i<G+;L76*
ec}aL
d3)UFT)S2kDA5
And the same package can be used to generate values in other columns (but I suppose ERRORID is a primary key, so you can use any other method which guarantess uniqueness - like sequence).
SQL> create sequence seq_x;
SQL> select x_seq.nextval, DBMS_RANDOM.STRING('p',DBMS_RANDOM.VALUE(1,30)) rand_str,
systimestamp + numtodsinterval(DBMS_RANDOM.VALUE(1,40),'MINUTE') rand_ts
from dual connect by level <= 10;
NEXTVAL RAND_STR RAND_TS
---------- ------------------------------ -----------------------------------
1 a?=PK7yA|L8]d/)3! 24.03.14 19:47:18,750326032 +04:00
2 $N+K4vksVx(npxm^'#/%.Aay5$, 24.03.14 19:50:48,361699672 +04:00
3 },7(1iX,2'E@i3u;wdg?.BB 24.03.14 19:35:15,711777571 +04:00
4 :S8x vj!m!:YI% fLCy8$\Y_}C 24.03.14 19:43:41,088255060 +04:00
5 /'oFj@+jOv3uFZC\z;^2+9GG~ 24.03.14 19:59:02,214021766 +04:00
6 8vTh0}[HYBEDy{4\ 24.03.14 20:06:34,600594460 +04:00
37 >u w9q)]c7/hB_butzNR\Oi!hWwO<& 24.03.14 19:36:39,010531153 +04:00
8 >GwzDBT8!?g}(<8;@I 24.03.14 19:51:52,118620451 +04:00
9 -] 'NxHUx46"_(df"8.u:6Pel" 24.03.14 19:44:04,152845952 +04:00
10 "HAJ 24.03.14 20:00:24,933479299 +04:00
Upvotes: 6