您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。