oracle´æ´¢¹ý³Ì--ÿÈÕͳ¼ÆÒ»¸ö±íÖеÄÊý¾Ý£¬²¢²åÈëÁíÒ»¸ö±íÖиù¾ÝLOGINFOºÍMEDICALINFO±íÖеÄÊý¾Ý£¬¸ù¾ÝDocIDºÍPROCTIME×ֶΣ¬²éѯ¼Ç¼£¬È»ºó¸ù¾ÝACTION×ֶεÄÖµ£¬½«²éѯ³öµÄÊý¾Ý²åÈëµ½ÁíÍâÒ»¸ö±íÖС£createorreplacePROCEDUREPROCEDURE1ASCURSORLOG_CURSORISSELECTTO_CHAR(PROCTIME,'YYYY-MM-DDHH24'),MEDICALINFO.APPCODE,LOGINFO.ACTION,COUNT(*)FROMLOGINFO,MEDICALINFOWHERELOGINFO.DOCID=MEDICALINFO.DOCIDANDTO_CHAR(PROCTIME,'YYYY-MM-DD')='2010-12-14'GROUPBYTO_CHAR(PROCTIME,'YYYY-MM-DDHH24'),MEDICALINFO.APPCODE,LOGINFO.ACTIONORDERBYAPPCODEDESC;PROCTIMESTRVARCHAR2(20);PROCTIMEDATE;APPCODEVARCHAR2(20);ACTIONNUMBER;COUNTSUMNUMBER;CREATESUMNUMBER;STAMPSUMNUMBER;PRINTSUMNUMBER;BEGINOPENLOG_CURSOR;LOOPFETCHLOG_CURSORINTOPROCTIMESTR,APPCODE,ACTION,COUNTSUM;SELECTTO_DATE(PROCTIMESTR,'YYYY-MM-DDHH24')INTOPROCTIMEFROMDUAL;EXITWHENLOG_CURSOR%NOTFOUND;IFACTION=1THENCREATESUM:=COUNTSUM;ELSIFACTION=2THENSTAMPSUM:=COUNTSUM;ELSIFACTION=3THENPRINTSUM:=COUNTSUM;ELSENULL;ENDIF;INSERTINTOACTIONLOG(LOGDATE,STARTHOUR,CREATESUM,STAMPSUM,PRINTSUM,DEPARTMENT)VALUES(PROCTIME,0,CREATESUM,STAMPSUM,PRINTSUM,APPCODE);ENDLOOP;CLOSELOG_CURSOR;ENDPROCEDURE1;