oracle归并-创新互联
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;
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享标题:oracle归并-创新互联
浏览路径:http://scyanting.com/article/cdgseh.html