Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Date format dd/mm/yyyy and ddmmyy
It's possible to have a format such "dd/mm/yyyy" and type something like
010197 using the following technique.
You must define a procedure :
PROCEDURE Siecle (jour IN OUT date) IS
Annee NUMBER;
BEGIN
Annee := TO_NUMBER(TO_CHAR(jour,'YYYY'));
IF Annee < 100 THEN
IF Annee < 50 THEN Jour := ADD_MONTHS(jour, 2000*12); ELSE Jour := ADD_MONTHS(jour, 1900*12); END IF;
RETURN Formate;
ELSE
RAISE VALUE_ERROR;
END IF;
ELSE
RAISE VALUE_ERROR;
END IF;
EXCEPTION
WHEN VALUE_ERROR THEN
Message (Type_erreur||'-'||TO_CHAR(code_erreur)||': '||texte_erreur);
RAISE FORM_TRIGGER_FAILURE;
END Format;
END;
and you associated to your field a trigger ON-ERROR like this :
:<block>.<field> := format;
Received on Thu Apr 24 1997 - 00:00:00 CDT