动态设置View的参数
动态设置View的参数
Sql代码
create or replace package p_view_param is
function set_param(num varchar2) return number;
function get_param return varchar2;
end p_view_param;
create or replace package body p_view_param is
paramValue varchar2(4000);
function set_param(num varchar2) return number is
begin
paramValue := num;
return 0;
end;
function get_param return varchar2 is
begin
return paramValue;
end;
end p_view_param;
视图中获取参数
create or replace view viewname as
select * from tablename where aa=p_view_param.get_param();
调用时如下
select * from viewname where p_view_param.set_param('dd')=0