Oracle journey (1) scheduled task settings

Source: Internet
Author: User

Oracle journey (1) scheduled task settings use pl/SQL to log on to the oracle database. In procedures, create a scheduled task, manipulate the logon table, and insert daily data into the temporary table. The SQL statements for scheduled tasks are as follows: create or replace procedure insertloginuser is // name of the scheduled task v_CreateLogin varchar2 (2000); v_YearMonth varchar2 (10); begin v_YearMonth: = to_char (sysdate-1, 'yyymmm '); --- the braces in the temporary table t_loginuser_temp are the byte segments to be inserted, and then query the statements to be inserted from t_chmo_login_record _ '| v_YearMonth |'. (LOGIN table: t_chmo_login_record _ month, for example, t_chmo_login_record_201205 access table in February May). below A table with several duplicates is used. V_CreateLogin: = 'insert into t_loginuser_temp (logincounts, L_PLATFORM, province_code, l_date) '| 'select logincounts, lr_name, records, sysdate-1 from (' | 'select count (lr_loginaccount) as logincounts, lr_name, lr_provincecode from (select l. lr_loginaccount, l. lr_provincecode, l. lr_name from t_chmo_login_record _ '| v_YearMonth | 'l where' | 'L. create_time> = to_date (to_char (sysdate-1, ''yyyy-MM-DD '') |'' 00:00:00 '', ''yyyy-MM-DD HH24: MI: s '') '|' and l. create_time <= to_date (to_char (sysdate-1, ''yyyy-MM-DD '') |'' 23:59:59 '', ''yyyy-MM-DD HH24: MI: s '') '|' and l. lr_status = 1) group by lr_name, lr_provincecode) '; execute immediate v_CreateLogin; COMMIT; end insertloginuser; Save and next date to set the time code for executing the next insert plan as follows: begin sys. dbms_job.submit (job =>: job, what => 'insertonlyuser; ', -- name next_date => to_date ('05-05-2013 01:51:22', 'dd-mm-yyyy hh24: mi: ss'), -- time interval => 'sysdate + 100'); -- the execution time distance, which is one day commit; end ;/

Related Article

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.