PL/SQL refcursor 질문 0 2 2,180

by 오라클 [PL/SQL] refcursor [2015.06.19 22:06:20]


제가 sys_refcursor를 열어서 프로시줘한테 인자로 줬는데요,

그리고 바로 for 로 돌리면서 레코드를 취득하려는데 안 되네요. 뭐가 문제인가요?

프로시줘에 넘기는 커서는 open 후에 줬어요.

 

create or replace procedure print(
   c sys_refcursor
  ,p_table varchar2
)
is
begin
  for r in c loop
    if p_table='emp' then
      dbms_output.put_line(r.empno||' '||r.ename);
    else p_table='dept' then
      dbms_output.put_line(r.deptno||' '||r.dname);
    else
      null;
    end if;
  end loop;
end;
/

오류(10,17): PLS-00103: Encountered the symbol "=" when expecting one of the following: := . ( @ % ;

by 마농 [2015.06.21 08:56:55]

오류 : else

수정 : elsif


by 오라클 [2015.06.24 11:11:23]

아~ 감사합니다.

댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입