首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

PL/SQL学习,该怎么解决

2013-06-19 
PL/SQL学习我创建了个函数,为什么编译的时候出错呢,还有调用数据的时候出不来呢?create or replace functi

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;后面缺一个“分号";

热点排行