Create or replace procedure P_114_SEARCHNT (o_Cursor Out sequence, I _Begindate In varchar2, -- start time I _Enddate In varchar2, -- end time I _citycode In varchar2 -- Address Code) /*************************************** * *** function: author: FC *************************************** * *****/is v_Begindate Date: = to_Date (I _Begindate, 'yyyy-mm-dd'); v_Enddate Date: = to_Date (I _Enddate, 'yyyy-mm-dd'); v_citycode varchar2 (20 ): = substr (I _citycode, 0, Instr (I _citycode, '|')-1); begin if v_citycode is null then v_citycode: = I _citycode; end if; open o_Cursor for select Keyword, count (1) as Searchtime, Searchcyc, Cityname from (select case when t. title is null then replace (t. content, 'query condition', ''), ':',''), '& nbsp;', '') else replace (t. title, 'query condition', ''), ':',''), '& nbsp;', '') end as Keyword, I _Begindate | 'to' | I _Enddate as Searchcyc, c. cityname as Cityname from T_WORKSHEET_LOG t, T_CITIES c where t. citycode = c. citycode and t. handledate> = v_Begindate and t. handledate <v_Enddate and t. action = 'A' and (t. citycode = v_citycode or 'gz '= v_citycode) group by Cityname, Keyword, Searchcyc; end P_114_SEARCHNT;