Consider the final validity until the next day at 03 AM using PLSQL

3

Personal, I need to do the following validation:
When a record enters my database, I need to validate the effective date of this record. If the validity is between the current date then the record is valid.
Ex:
Effective 12/03/2015 to 03/13/2015, the validity expires on 03/13/2015 correct?
But I need to consider the final date until 03/03/2015 at 03:00 in the morning, after this time the final date will no longer be valid. Does anyone have any idea how I can create this rule?

    
asked by anonymous 13.03.2015 / 13:40

1 answer

1

Something like this

CREATE OR REPLACE TRIGGER TRG_TABELA
  BEFORE
    INSERT OR
    UPDATE 
  ON TABELA
BEGIN
  /*3 horas de "hoje" até 3 horas de "amanhã"*/
  IF NOT (DATA BETWEEN (TRUNC(SYSDATE) + 3/24) AND TRUNC(SYSDATE+1) + 3/24)) THEN
    RAISE_APPLICATION_ERROR(-20001,'DATA INVÁLIDA PARA PERÍODO');
  END IF;
END;
/
    
13.03.2015 / 22:27