Oracle视图 传参数 解决办法
创建包:
create or replace package p_view_param is
function set_param(num number) return number;
function get_param return number;
end p_view_param;
create or replace package body p_view_param is
paramValue number;
function set_param(num number) return number is
begin
paramValue:=num;
return num;
end;
function get_param return number is
begin
return paramValue;
end;
end p_view_param;
视图的建立:
create or replace view p_view_user as
select id,realName,address from tbl_info where id=p_view_param.get_param();
PL/SQL调用:
select * from p_view_user where p_view_param.set_param(2781)=2781
阅读(2514) | 评论(0) | 转发(0) |