我一直在尝试运行这个脚本,但我得到的只是这个错误:
Error report:
ORA-06550: line 3, column 15:
PLS-00103: Encountered the symbol "IS" when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp interval date binary national character
nchar
The symbol "IS" was ignored.
Run Code Online (Sandbox Code Playgroud)
这是我的脚本:
set serveroutput on
DECLARE
cursor depts_cur is select dname from dept;
depts_cur_rec is depts_cur%type;
BEGIN
loop
fetch depts_cur into depts_cur_rec;
exit when depts_cur_rec%notfound;
dbms_output.put_line('Department: ' || depts_cur_rec);
end loop;
close depts_cur;
END;
Run Code Online (Sandbox Code Playgroud)
非常感谢您的帮助.
小智 6
看起来你的depts_cur_rec声明是错误的,试试这个(删除"是"):
set serveroutput on
DECLARE
cursor depts_cur is select dname from dept;
depts_cur_rec depts_cur%type;
BEGIN
BEGIN loop
fetch depts_cur
into depts_cur_rec;
exit when depts_cur_rec%notfound;
dbms_output.put_line('Department: ' || depts_cur_rec);
end loop;
close depts_cur;
END;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9397 次 |
| 最近记录: |