DECLARE
TYPE num_tt IS TABLE OF INT;
num_t1 num_tt:=num_tt();
num_t2 num_tt:=num_tt();
num_t3 num_tt:=num_tt();
i_1 INT := 1;
j_1 INT := 1;
d_1 INT := 1;
BEGIN
num_t1.extend(20);
num_t2.extend(20);
num_t3.extend(num_t1.count+num_t2.count);
FOR i IN 1..20 LOOP
num_t1(i) := trunc(dbms_random.value(200,100000));
END LOOP;
dbms_output.put_line('num_t1:');
quick_sort(num_t1, 1, num_t1.count);
FOR i IN 1..num_t1.count LOOP
dbms_output.put_line(num_t1(i)||',');
END LOOP;
FOR i IN 1..20 LOOP
num_t2(i) := trunc(dbms_random.value(200,100000));
END LOOP;
dbms_output.put_line('num_t2:');
quick_sort(num_t2, 1, num_t2.count);
FOR i IN 1..num_t2.count LOOP
dbms_output.put_line(num_t2(i)||',');
END LOOP;
WHILE(i_1 <= num_t1.count AND j_1 <= num_t2.count) LOOP
IF(num_t1(i_1) > num_t2(j_1)) THEN
num_t3(d_1) := num_t2(j_1);
j_1 := j_1 + 1;
ELSE
num_t3(d_1) := num_t1(i_1);
i_1 := i_1 + 1;
END IF;
d_1 := d_1 + 1;
END LOOP;
IF(i_1<=num_t1.count) THEN
FOR i IN i_1..num_t1.count LOOP
num_t3(d_1) := num_t1(i);
d_1 := d_1+1;
END LOOP;
ELSE
FOR i IN j_1..num_t2.count LOOP
num_t3(d_1) := num_t2(i);
d_1 := d_1+1;
END LOOP;
END IF;
dbms_output.put_line('num_t3:');
FOR i IN 1..num_t3.count LOOP
dbms_output.put_line(num_t3(i)||',');
END LOOP;
END;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。