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;
------解决方案--------------------报什么错? ?????
------解决方案--------------------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;后面缺一个“分号";