【发布时间】:2015-02-02 18:55:20
【问题描述】:
DECLARE
TYPE myarray is varray(10) of pls_integer;
unsorted myarray := myarray();
min pls_integer;
begin
unsorted := myarray(2,5,8,6,4,9,1,3,7,10);
FOR i in 1 .. unsorted.count-1 loop
begin
for j in i+1 .. unsorted.count loop
begin
if(unsorted(j)<unsorted(i))
then
begin
min := unsorted(i);
unsorted(i) := unsorted(j);
unsorted(j) := min;
end;
end if;
end;
end loop;
dbms_output.put_line(unsorted(i));
end;
end loop;
end;
我的代码给出错误我无法理解为什么? ORA-06550:第 16 行,第 31 列: PLS-00103:遇到符号“;”预期以下情况之一时:
【问题讨论】:
-
冒泡排序?使您的集合成为 SQL 类型,然后使用 select 对其进行排序。