Home » SQL & PL/SQL » SQL & PL/SQL » create a trigger execute in particular date.
create a trigger execute in particular date. [message #234796] Thu, 03 May 2007 03:29 Go to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Hi,

I want to create a trigger in my applications.
my recruitment is following:

In a table emp every month particular(example 5th of every month) date is execute a trigger.

How can i do it. Am a new person in trigger concepts.pls coding ..


Thanks,

Arun.. Razz
Re: create a trigger execute in particular date. [message #234800 is a reply to message #234796] Thu, 03 May 2007 03:43 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Triggers are not executed at some specific time but at some specifc event, so you can't use triggers for that.

Depending on your Database version you can use dbms_job (9.x) or dbms_scheduler (10.x)

Re: create a trigger execute in particular date. [message #234801 is a reply to message #234796] Thu, 03 May 2007 03:43 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
What you are looking for is a job. Depending on your version you can use DBMS_JOB or DBMS_SCHEDULER to execute a stored procedure monthly.

Edit: too late - again Sad

MHE

[Updated on: Thu, 03 May 2007 03:44]

Report message to a moderator

Re: create a trigger execute in particular date. [message #234802 is a reply to message #234796] Thu, 03 May 2007 03:45 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Have you read the Oracle Documentation about triggers ?
If not, do so...

Instead of a trigger you might want to consider creating a database job that executes a procedure(for example) on a specifik date.

Got to speed up my writing,even Maaher got me Razz

[Updated on: Thu, 03 May 2007 03:46]

Report message to a moderator

Re: create a trigger execute in particular date. [message #234811 is a reply to message #234796] Thu, 03 May 2007 03:59 Go to previous messageGo to next message
saibal
Messages: 111
Registered: March 2007
Location: India
Senior Member
If your idea is to execute a trigger on the 5th of every month, then you can try the following:
Suppose you want to prevent an updation on the emp table on the 5th of every month-

create or replace trigger t1
before update on emp
begin
if to_char(systimestamp,'dd')=05
then if updating
then raise_application_error(-20001,'No updation today');
end if;
end if;
end;

/
Re: create a trigger execute in particular date. [message #234815 is a reply to message #234811] Thu, 03 May 2007 04:02 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Remove to_char function to check, this is an old way, to_char is just for display, use EXTRACT.

Regards
Michel
Previous Topic: Trigger problem
Next Topic: key voilation
Goto Forum:
  


Current Time: Sat Dec 03 09:50:13 CST 2016

Total time taken to generate the page: 0.07967 seconds