2
2
# Licensed under the Universal Permissive License v 1.0
3
3
# as shown at https://oss.oracle.com/licenses/upl/
4
4
5
- # bengsig 17-jun-2023 - add mtit_partitions parameter
5
+ # bengsig 18-jun-2024 - prevent ORA-1 risk
6
+ # bengsig 17-jun-2024 - add mtit_partitions parameter
6
7
# bengsig 10-jun-2024 - Add hcc table
7
8
# bengsig 30-may-2024 - loadfactor used to mute threads
8
9
# bengsig 17-apr-2024 - no stats when idling
28
29
# mtit_type / 100
29
30
#
30
31
# 0 - The sequence is part of the insert itself
31
- # and put into seq, rno is then always 0
32
+ # and put into seq, rno is then always 1
32
33
# as the seq column itself is unique
33
34
#
34
35
# 1 - Primary keys come from a separate query
35
36
# from dual that gets one sequence number
36
37
# that goes into the seq column, and rno is
37
- # then a number in the range 1..rowsperins
38
- # so uniqueness is from both columns
38
+ # then based on a number in the range
39
+ # 1..rowsperins but with the last two
40
+ # digits in the range 02 .. 99 so
41
+ # uniqueness is from both columns
39
42
#
40
43
# 2 - The primary key is in principle external
41
- # we do however generate it. See below.
44
+ # we do however generate it. Note that for
45
+ # these, the last two digits of rno is always
46
+ # 00.
47
+ #
48
+ # Effectively the three different mtit_type/100 values
49
+ # are guaranteed to not overlap, preventing ORA-00001
42
50
#
43
51
# mtit_type%100 describes the index used for the
44
52
# primary key plus the type of sequence when relevant
@@ -163,10 +171,10 @@ procedure mtit_ins_rows()
163
171
values (:seq, :rno, :val, :payload)";
164
172
else
165
173
# include seq in values clause
166
- # and set rno to 0
174
+ # and set rno to 1
167
175
modify sql mtit_ins_sql for
168
176
"insert into " mtit_tab " (seq, rno, val, payload)
169
- values (" mtit_seq ".nextval, 0 , :val, :payload)";
177
+ values (" mtit_seq ".nextval, 1 , :val, :payload)";
170
178
end if;
171
179
172
180
modify sql mtit_ins_sql array mtit_array_size;
@@ -183,13 +191,16 @@ $endif
183
191
nostatistics;
184
192
wait 1;
185
193
else
186
- for rno := 1 .. mtit_rows_per_exec loop
194
+ integer rno2;
195
+ for rno2 := 1 .. mtit_rows_per_exec loop
187
196
if mtit_type%100 != 7 then
188
197
val := uniform(0.0,1000.0);
189
198
else
190
199
val := round(uniform(0,1000));
191
200
end if;
192
201
sprintf payload, "%05d-%s-%05d", uniform(0,99999), ovid2load, uniform(0,99999);
202
+ # make rno unique and have last digits in the range 02 .. 99
203
+ rno := 2 + rno2%98 + 100 * (rno2/98);
193
204
mtit_ins_sql;
194
205
mtit_count_ins_rows();
195
206
end loop;
0 commit comments