REM ---- save as FURNITURE.SQL
REM ---- PURPOSE: To BUILD A TABLE THAT DEMONSTRATES
REM ---- ROW CHAINING, AND HOW TO FIX THE PROBLEM in ORACLE 9i
REM ---- RUN THIS SCRIPT AFTER RUNNING PASTA_INSTALL.SQL
REM ---- (SO THAT YOU CAN GENERATE RANDOM JUNK IN TABLES!!!)
create table FURNITURE (
SOFA number(4),
CHAIR varchar2(4000),
DINING_TABLE varchar2(4000),
DESK varchar2(1000) );
set serveroutput on
pro THIS WILL TAKE A FEW MINUTES, PLEASE BE PATIENT!
declare
x number :=1;
begin
for x in 1..500
loop
begin
declare cursor c1 is select random.rand_string(3800) www from dual;
cursor d1 is select random.rand_max(9999) zzz from dual;
cursor e1 is select random.rand_string(3900) yyy from dual;
begin
for c2 in c1 loop
null;
for d2 in d1 loop
null;
for e2 in e1 loop
null;
insert into FURNITURE (sofa, chair, dining_table, desk)
values (d2.zzz, c2.www, substr(e2.yyy,80,3800), substr(e2.yyy,1,900));
end loop;
end loop;
end loop;
end;
end;
end loop;
commit;
end;
/