oracle多条件查询分页存储过程Oracle认证考试
文章作者 100test 发表时间 2010:01:01 10:00:05
来源 100Test.Com百考试题网
项目接近尾声了,感觉将业务逻辑放到oracle中使得后台代码很精简,oracle很有搞头!
PL\SQL:
create or replace procedure proc_client_List --客户多条件查询
(
pro_cursor out pkg_order.p_cursor, --查询结果集
characters_ in varchar2,--客户性质
states_ in varchar2,--客户状态
type_ in varchar2,--客户类型
calling_ in varchar2,--客户行业
name_ in varchar2,--客户名称
beginTime_ in date,--创建日期上限
endTime_ in date,--创建日期上限
area_ in number,--客户地区
clientsource_ in varchar2,--客户来源
importent_ in varchar2,--重要程度
start_row in number,--结果集起始行
end_row in number--结果集结束行
) is
sql_str varchar2(1000):=
0select * from
( 0select row_.*, rownum rownum_ from
(
0select * from clientinfo c
where(:characters_ is null or c.characters like :characters_)
and (:states_ is null or c.states like :states_)
and (:type_ is null or c.type like :type_)
and (:calling_ is null or c.calling like :calling_)
and (:name_ is null or c.name like :name_)
and (:beginTime_ is null or c.createtime