读书人

PL/SQL学习,该怎么解决

发布时间: 2013-06-19 10:26:41 作者: rapoo

PL/SQL学习
我创建了个函数,为什么编译的时候出错呢,还有调用数据的时候出不来呢?
create or replace function selectallemployments
return sys_refcursor as st_cursor sys_refcursor
begin
open st_cursor for select * from emp;
return st_cursor;
end;


declare
x sys_refcursor;
v_emp emp%rowtype;
begin
x := selectallemployments;
loop
fetch x into v_emp;
exit when x%notfound;
dbms_output.put_line('员工编号:'||v_emp.empno||' 员工名称:'||v_emp.ename);
end loop;
end;
PL/SQL
[解决办法]
报什么错? ?????
[解决办法]

create or replace function selectallemployments return sys_refcursor 
as
st_cursor sys_refcursor;
begin
open st_cursor for select * from emp;
return st_cursor;
end;


sys_refcursor;后面缺一个“分号";

读书人网 >oracle

热点推荐