Oracle Create simple stored procedure sample

Source: Internet
Author: User

1. Create a stored procedure

Create or Replace procedure p_dmi_agent is
begin
Delete dmi_agent;
INSERT INTO Dmi_agent SELECT * from Dmi_agent_v_sysdate;
INSERT INTO Dmi_agent SELECT * from dmi_agent_v_sysdate1;
INSERT INTO Dmi_agent SELECT * from Dmi_agent_v_sysdate2;
INSERT INTO Dmi_agent_log (dateid,taskno,successcnt) VALUES (To_number (To_char (sysdate, ' YYYYMMDD ')), ' Group Human Push interface ', ' 1 ');
exception when others then
INSERT INTO Dmi_agent_log (dateid,taskno,successcnt) VALUES (To_number (To_char (sysdate, ' YYYYMMDD ')), ' Group Human Push interface ', ' 0 ');
end;

2. Create an execution plan

Declare
Job integer;
Begin
Dbms_job.submit (Job, 'p_dmi_agent; ', Trunc (sysdate), ' Trunc (sysdate) +1 ');
Commit
End

3. Query plan

SELECT j.job,j.last_date,j.last_sec,j.next_date,j.next_sec,j.interval,j.what from dba_jobs j where J.WHAT = ' p_dmi_agent; ';

Oracle Create simple stored procedure sample

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.