Home » RDBMS Server » Server Administration » Scheduled Job or Stored Procedure
Scheduled Job or Stored Procedure [message #165048] Tue, 28 March 2006 03:14 Go to next message
kianwatt
Messages: 1
Registered: March 2006
Junior Member
Hi

I have a simple tasks. I need to perform the following sql statement on 01-Apr-2006 @ 12am.

Update myTable set nextvalue=1

How do i go about doing that? I am using Oracle 9.1.0.6 on Windows 2000 . Thanks Smile
Re: Scheduled Job or Stored Procedure [message #165087 is a reply to message #165048] Tue, 28 March 2006 05:16 Go to previous messageGo to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member

Create a procedure to update the value and schedule it using DBMS_JOB package.
Read the manuals to know more about job scheduling in Oracle.
Re: Scheduled Job or Stored Procedure [message #165112 is a reply to message #165048] Tue, 28 March 2006 06:29 Go to previous message
kmsalih
Messages: 197
Registered: March 2006
Senior Member
Hi,

Using DBMS_JOB Package you can Schedule a job.

See the Example which worked successfully.

-- create a table for testing
create table salih.a
(
a number,
b date default sysdate
);


--create a procedure for inserting

create or replace procedure sample_ins_job
as
begin
insert into salih.a(a) values(1);
commit;
end;
/


-- Submission of Job (Here the date and time is 28th March 2006 6 PM

variable j number;
begin
dbms_job.submit(job=>:j,what=>'begin sample_ins_job; end;',next_date=>to_date('28-MAR-2006 18:00:00','DD-MON-YYYY HH24:MI:SS'));
commit;
end;
/


--Viewing the changes
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
select * from salih.a;

Regards
SALIH

Previous Topic: snapshot too old error
Next Topic: "ORA-12154: TNS : Culd not resolve the connect identifier specified"
Goto Forum:
  


Current Time: Fri Sep 20 13:41:04 CDT 2024