Home » SQL & PL/SQL » SQL & PL/SQL » problem with dates
problem with dates [message #2804] Wed, 14 August 2002 04:23 Go to next message
prashant
Messages: 122
Registered: September 2000
Senior Member
Hi all,
I want to write a trigger that will prevent any one from inserting any records on a particular table ( say emp ) between 7 in the evening and 6 in the morning

i am facing a problem while comparing if the sysdate is between the given range or not. Please help
Re: problem with dates [message #2816 is a reply to message #2804] Wed, 14 August 2002 09:40 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
create or replace trigger emp_trg
before insert on emp
begin
  if    to_char(sysdate, 'hh24') >= '19'
     or to_char(sysdate, 'hh24') <= '06' then

    raise_application_error(-20000, 'Inserts not allowed in this timeframe');

  end if;
end;
/
Previous Topic: Re: Summing up data by quarters
Next Topic: cumulative addition
Goto Forum:
  


Current Time: Tue May 14 12:27:26 CDT 2024