Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

procedure and job to run everyday

622694Jan 17 2011 — edited Jan 19 2011
Hi All,

I have made a procedure and I want it to run every day tuesday to saturday.

If I run that procedure in anonymous block, it runs but I have created job for this to run the procedure (every day for testing and once testing is done tuesday to saturday). But job does not run. Please help me.



body of the procedure is :

create or replace PROCEDURE IT_DEFAULTER_REP
IS
v_count number;
BEGIN
FOR c1 in
(Select e.person_id,e.person_name name,e.username,e.person_email,e.person_role, m.person_name m_name,m.person_email m_email
from it_people e, it_people m
where e.reporting_to = m.person_id
and e.assigned_project =
(select project_id
from it_projects
where project_name = 'Infra'))
LOOP
SELECT count(*)
into v_count
from it_issues_progress
where upper(modified_by) = upper(c1.username)
and to_char(trunc(modified_on),'dd-mon-yy') = to_char((sysdate-1),'dd-mon-yy') ;

if c1.person_email is not null and v_count = 0 and c1.person_role = 'Member'
then


APEX_MAIL.SEND(
p_to => c1.person_email,
p_from => 'apex_system@nab.com.au',
p_body => 'Hi '||c1.name||','||chr(10)||chr(10)||

'You have been reported as Non Compliant for '||(sysdate-1)||chr(10)||
'Please ensure that you submit your details every day'||chr(10)||chr(10)||
'Note: This is a system generated mail. Please DO NOT Reply to this e-mail id',


p_subj => 'Non Compliant for '||(sysdate-1),
p_cc => c1.m_email||','||'kumar.rajesh@oracle.com,Ganesh.Prabhu@nab.com.au,brett.kennedy@oracle.com');



END IF;



END LOOP;
END;



and I have created a job for this:


create or replace procedure push_it_defaulter_rep as
jobno number;
BEGIN
DBMS_JOB.SUBMIT(
job => jobno,
what => 'begin it_defaulter_rep; end;',
next_date => to_date(SYSDATE,'dd-mon-yy'), -- this is only for testing
interval => to_date(sysdate + 1/1440,'dd-mon-yy')); -- -- this is only for testing

COMMIT;

END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2011
Added on Jan 17 2011
4 comments
210 views