오라클 패키지 내에서 동적 SQL의 사용에 대하여...
아래와 같이 사용할수 없는 건가요..자꾸 오류가 발생해서..
CREATE OR REPLACE package pkg_cashreport as
--cursot define
type t_cursor is ref cursor ;
procedure sp_report1 (no in number, io_cursor out t_cursor);
end pkg_cashreport;
/
CREATE OR REPLACE package body pkg_cashreport as
procedure sp_report0 (no in number, io_cursor out t_cursor)
is
v_cursor t_cursor;
stmt varchar2(100);
cur_no integer;
begin
stmt := ' open v_cursor for select * from junpyo where no = '|| no ;
cur_no := dbms_sql.open_cursor;
dbms_sql.parse(cur_no, stmt, dbms_sql.native);
dbms_sql.close_cursor(cur_no);
io_cursor := v_cursor;
end sp_report0;
end pkg_cashreport;
/
--cursot define
type t_cursor is ref cursor ;
procedure sp_report1 (no in number, io_cursor out t_cursor);
end pkg_cashreport;
/
CREATE OR REPLACE package body pkg_cashreport as
procedure sp_report0 (no in number, io_cursor out t_cursor)
is
v_cursor t_cursor;
stmt varchar2(100);
begin
stmt := ' select * from junpyo where no = '|| no ;
open v_cursor for stmt;
io_cursor := v_cursor;
end sp_report0;
end pkg_cashreport;
/
nilriri wrote:
> 오라클 패키지 내에서 동적 SQL의 사용에 대하여...
>
> 아래와 같이 사용할수 없는 건가요..자꾸 오류가 발생해서..
>
>
> CREATE OR REPLACE package pkg_cashreport as
> --cursot define
> type t_cursor is ref cursor ;
>
> procedure sp_report1 (no in number, io_cursor out t_cursor);
>
> end pkg_cashreport;
> /
>
> CREATE OR REPLACE package body pkg_cashreport as
> procedure sp_report0 (no in number, io_cursor out t_cursor)
> is
> v_cursor t_cursor;
> stmt varchar2(100);
> cur_no integer;
> begin
> stmt := ' open v_cursor for select * from junpyo where no = '|| no ;
>
> cur_no := dbms_sql.open_cursor;
> dbms_sql.parse(cur_no, stmt, dbms_sql.native);
> dbms_sql.close_cursor(cur_no);
>
> io_cursor := v_cursor;
> end sp_report0;
>
> end pkg_cashreport;
> /
>
>