智者樂山山如畫, 仁者樂水水無涯。 從從容容一盃酒, 平平淡淡一盞茶。 細雨朦朧小石橋, 春風盪漾小竹筏。 夜無明月花獨舞, 腹有詩書气自華。 吾生有崖,也知無崖,以有崖逐無崖,殆也

Oracle 查询

<MyCommand Name="日常测评列表" Database="ZDXMGL_SH" CommandType="Text">
<Parameters>
<Parameter Name="Sysid" Type="Int32" Direction="Input" />
<Parameter Name="ryfl" Type="Varchar2" Direction="Input" />
<Parameter Name="kw" Type="Varchar2" Direction="Input" />
<Parameter Name="page" Type="Int32" Direction="Input" />
<Parameter Name="limit" Type="Int32" Direction="Input" />

<Parameter Name="cur1" Type="RefCursor" Direction="Output" />
<Parameter Name="total" Type="Int32" Direction="Output" />
</Parameters>
<CommandText><![CDATA[
begin
open :cur1 for
select * from (
select t.*, rownum rn from (
Select to_char(s.cjsj,'yyyy') sjnf
,to_char(s.cjsj,'yyyy-MM-dd HH:mi:ss') psrq
,s.userid
,s.username
,u.deptname
,u.jobnamelist
,u.cardid
,(u2.deptname ||'('|| p.username||')') pusername
,s.df
,x.title
FROM t_Evaluation_Score s
Left Join t_evaluation_person p On s.PERSONID =p.sysid
Left Join t_Evaluation x On x.sysid=p.eVALUATIONID
Left Join vsys_user_employeedetail u On s.userid=u.USERID
Left Join vsys_user_employeedetail u2 On p.userid=u2.USERID
where x.sysid=(case when :Sysid =0 then x.sysid when :Sysid>0 then :Sysid end)
and to_char(u.cardid)=(Case When :ryfl is not null Then to_char(:ryfl) When :ryfl is null Then to_char(u.cardid) End)
--and (Case When :kw is not null Then instr( s.username ,:kw)>0 then :kw is null then 1=1 End)
and instr( s.username,(case when :kw is not null then to_char(:kw) when :kw is null then s.username end))>0
) t
where rownum <= :page*:limit
)
where rn > (:page-1)*:limit;

Select count(*) into :total
FROM t_Evaluation_Score s
Left Join t_evaluation_person p On s.PERSONID =p.sysid
Left Join t_Evaluation x On x.sysid=p.eVALUATIONID
Left Join vsys_user_employeedetail u On s.userid=u.USERID
where x.sysid=(case when :Sysid =0 then x.sysid when :Sysid>0 then :Sysid end)
and to_char(u.cardid)=(Case When :ryfl is not null Then to_char(:ryfl) When :ryfl is null Then to_char(u.cardid) End)
and instr( s.username,(case when :kw is not null then to_char(:kw) when :kw is null then s.username end))>0
;
end;

]]></CommandText>
</MyCommand>

 

posted @ 2024-08-21 01:28  後生哥哥  阅读(3)  评论(0编辑  收藏  举报
智者樂山山如畫, 仁者樂水水無涯。 從從容容一盃酒, 平平淡淡一盞茶。 細雨朦朧小石橋, 春風盪漾小竹筏。 夜無明月花獨舞, 腹有詩書气自華。 吾生有崖,也知無崖,以有崖逐無崖,殆也