您在光标末尾缺少一个分号:
CURSOR employees_in_10_cur
IS
SELECT *
FROM ad_week_table;
错误消息将始终为您提供发生错误的行号。请始终检查并查看该区域。
例如; 如果我更改表以便可以运行它,我会得到以下信息:
SQL> declare
2
3 cursor employees_in_10_cur is
4 select *
5 from user_tables
6
7 begin
8 for employee_rec in employees_in_10_cur loop
9 dbms_output.put_line (
10 employee_rec.ad_no || ',' || employee_rec.week_no );
11 end loop;
12 end;
13 /
for employee_rec in employees_in_10_cur loop
*
ERROR at line 8:
ORA-06550: line 8, column 8:
PL/SQL: ORA-00905: missing keyword
ORA-06550: line 4, column 5:
PL/SQL: SQL Statement ignored
ORA-06550: line 11, column 4:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
begin function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> current cursor delete
exists prior
您有 3 个错误;一个在第 8 行,因为光标无效,一个在第 11 行,因为循环没有发生,因为光标无效,一个在第 4 行,上面写着“语句被忽略”。