--创建存储过程
create or replace package pkg_pv is
procedure set_pv(pv varchar2);
function get_pv return varchar2;
end;
create or replace package body pkg_pv is
v varchar2(20);
procedure set_pv(pv varchar2) is begin v:=pv; end;
function get_pv return varchar2 is begin return v; end;
end;
--创建带参视图
create view v_emp as select * from emp where ename=pkg_pv.get_pv();
--调用过程,结果正确执行
begin
pkg_pv.setpv('scotte');
end;
select * from v_emp;
create or replace package pkg_pv is
procedure set_pv(pv varchar2);
function get_pv return varchar2;
end;
create or replace package body pkg_pv is
v varchar2(20);
procedure set_pv(pv varchar2) is begin v:=pv; end;
function get_pv return varchar2 is begin return v; end;
end;
--创建带参视图
create view v_emp as select * from emp where ename=pkg_pv.get_pv();
--调用过程,结果正确执行
begin
pkg_pv.setpv('scotte');
end;
select * from v_emp;