Used to delete a user that is considered offline when the number of online users is displayed.

Source: Internet
Author: User

Number of online users in the status bar!
Idea: use the process of refreshing messages in real time to calculate the number of online users from the database table. If you have stayed for more than 20 minutes, you will be taken offline.
Table used: upline
Create table online -- used to display online users
(User_id number,
OperateTiem date
)

Used to delete offline users

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.