本文主要是通過介紹Oracle查詢分頁的存儲過程的相關實際應用代碼來引出Oracle查詢分頁的存儲過程 ,如果你在Oracle查詢分頁的存儲過程 存在不解之處時,你不妨浏覽下面的文章,希望你能從中獲得自己想要的東西。
項目接近尾聲了,感覺將業務邏輯放到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):=
- 'select * from
- ( select row_.*, rownum rownum_ from
- (
- select * 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 > :beginTime_)
- and (:endTime_ is null or c.createtime < :endTime_)
- and (:area_ is null or c.area=:area_)
- and (:clientsource_ is null or c.clientsource like :clIEntsource_)
- and (:importent_ is null or c.importent like :importent_)
- ) row_ where rownum <= :end_row
- )
- where rownum_ > :start_row';
- begin
- open pro_cursor for sql_str using
- characters_,'%'||characters_||'%',
- states_,'%'||states_||'%',
- type_,'%'||type_||'%',
- calling_,'%'||calling_||'%',
- name_,'%'||name_||'%',
- beginTime_,beginTime_,
- endTime_,endTime_,
- area_,area_,
- clientsource_,'%'||clIEntsource_||'%',
- importent_,'%'||importent_||'%',
- end_row,start_row;
- end proc_clIEnt_List;
- /