用於在顯示在線人數時,刪除認爲已經離線的用戶

狀態欄中的在線人數功能!
思路:利用實時刷新消息的過程,一起從數據庫表中算出在線人數。已操作停留20分鐘以上的看待成離線狀態。
所用表:upline
Create table online   --用於顯示在線人數
( user_id  number,
 OperateTiem  date
)

用於刪除離線人數

create or replace procedure DelOnLine is
       cursor c_upline is select * from upline;
       ss number;
begin
     for man in c_upline loop
         select (sysdate - man.operatetime)*24*60*60 into ss from dual;
         if ss > 60 then
            delete from upline where user_id = man.user_id;           
         end if;
     end loop;
end DelOnLine;

發佈了45 篇原創文章 · 獲贊 0 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章