oracle 视图带参数
--15689869 create or replace package p_view_param is --参数一 function set_ID(num number) return number; function get_ID return number; end p_view_param; -- create or replace package body p_view_param is paramValue number; -- Param function set_ID(num number) return number is begin paramValue:=num; return num; end; function get_ID return number is begin return paramValue; end; end p_view_param; /* *定义视图,where 后面跟参数,可自己拼装,注意视图字段要和select的字段匹配 */ CREATE OR REPLACE VIEW RSK_BOOK_VIEW(risk_book_id, risk_book_code, risk_book_name, risk_type, risk_model_type, bucket_type, volatility_type, correlation_type, valuation_method, decomposition_method, explanation_level, time_horizon, var_limit_level, user_id, create_uid, create_uname, create_oid, create_pid, create_date, last_mod_uid, last_mod_uname, last_mod_oid, last_mod_pid, last_mod_datetime, created_employee_name, created_employee_id, is_deleted) AS SELECT risk_book_id, risk_book_code, risk_book_name, risk_type, risk_model_type, bucket_type, volatility_type, correlation_type, valuation_method, decomposition_method, explanation_level, time_horizon, var_limit_level, user_id, create_uid, create_uname, create_oid, create_pid, create_date, last_mod_uid, last_mod_uname, last_mod_oid, last_mod_pid, last_mod_datetime, created_employee_name, created_employee_id, is_deleted FROM RSK_BOOK f where f.RISK_BOOK_ID=p_view_param.get_ID(); --参数 --使用视图,传参 select * from RSK_BOOK_VIEW where p_view_param.set_id(15689869)=15689869 ;