狀態欄中的在線人數功能!
思路:利用實時刷新消息的過程,一起從數據庫表中算出在線人數。已操作停留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;