今天碰到执行PL/SQL块报错,根据错误提示是提交给oracle的sql(过程和函数)写法不符合oracle的标准。分析得出是块中有不明字符,将空格部分去掉即可。
SQL> declare
2 type numbers is table of number;
3 n numbers := numbers();
4 begin
5 n.extend;
6 n(1) := 2;
7 n.extend;
8 n(2) := 3;
9 for i in 1 .. n.count loop
10 dbms_output.put_line(n(i));
11 end loop;
12 end;
13 /
declare
type numbers is table of number;
n numbers := numbers();
begin
n.extend;
n(1) := 2;
n.extend;
n(2) := 3;
for i in 1 .. n.count loop
dbms_output.put_line(n(i));
end loop;
end;
ORA-06550: line 3, column 2:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
SQL> declare
2 type numbers is table of number;
3 n numbers := numbers();
4 begin
5 n.extend;
6 n(1) := 2;
7 n.extend;
8 n(2) := 3;
9 for i in 1..n.count loop
10 dbms_output.put_line(n(i));
11 end loop;
12 end;
13 /
PL/SQL procedure successfully completed
--转自