Guys, I need to do the following validation:
When a registration enters my database, I need to validate the effective date of this registration. If the term is between the current date then the registration is valid.
Effective from 12/03/2015 to 13/03/2015, the term ends on 13/03/2015 correct?
But I need to consider the end date until 03/14/2015 at 03:00 am, after this time the end date will no longer be valid.
Does anyone have any idea how I can create this rule?
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; /