oracle snake_trian
DECLARE
TYPE arr1_tt IS TABLE OF INT INDEX BY PLS_INTEGER;
TYPE arr2_tt IS TABLE OF arr1_tt INDEX BY PLS_INTEGER;
arr2_inst arr2_tt;
ROW INT := 1;
col INT := 1;
tmprow INT := 0;
tot INT := 0;
BEGIN
WHILE(ROW<=5) LOOP
col := 1;
tmprow := ROW;
WHILE(col<=ROW) LOOP
tot := tot + 1;
arr2_inst(tmprow)(col) := tot;
tmprow := tmprow-1;
col := col + 1;
END LOOP;
ROW := ROW + 1;
END LOOP;
FOR i IN 1..arr2_inst.count LOOP
FOR j IN 1..arr2_inst(i).count-i+1 LOOP
dbms_output.put_line(arr2_inst(i)(j)||‘‘);
END LOOP;
END LOOP;
END;
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。