Oracle Stored Procedure

Source: Internet
Author: User

Create or replace procedure proc_update_staffinfo
Is
Temp number;
Cursor cur_staff is select * From hr_rs_staff where deleted = 0 and sysdate> entryTime + 365;
Begin
For u in cur_staff
Loop
Temp: = Mod (floor (sysdate-to_date (U. entryTime, 'yyyy-mm-dd'), 365 );

If temp <> 0 then
-- Employee enterprise age
Update hr_rs_staff set incluisesage = incluisesage + 1 where id = U. ID;

-- Employee annual leave information
Select count (*) into temp from hr_kq_staffannualleave where id = U. ID;
If temp = 0 then
Insert into hr_kq_staffannualleave (ID, staffid, numberofdays, deleted, createtime, modifytime) values (U. ID, U. ID, 5, 0, sysdate, sysdate );
Else
Update hr_kq_staffannualleave set numberofdays = 40 where id = U. ID;
End if;
End if;
End loop;
End;

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.