Does it make any difference to prefer varchar2 over date data type when building data warehouse in Oracle. My data warehouse is not totally warehouse because date dimension is not necessary (no need for date hierarchy) and it is enough to save date as plain ‘MM-DD-YYYY’ formatted string. Which data type to use nevertheless?
Share
Let’s do a little cost/benefit analysis, shall we?
Leave the "date" field as
VARCHAR2Pros:
MM-DD-YYYYformat).Cons:
TO_DATEcallsTO_CHAR(TO_DATE(date_column, 'MM-DD-YYYY'), 'DD-MON-YYYY'))TO_DATEis necessary.Change the "date" field to
DATEPros:
TO_DATECons:
Hopefully this will help in your particular decision from a technical perspective. There is always the business (or, office politics) perspective:
I will fix that for you:
Suppose you leave the column as
VARCHAR2and the client comes along and asks to filter some report on this date field. Suppose this is killing the database server and you finally need to convert it toDATE. Is it relatively easy to make this change in a production environment at your company? Is there plenty of red tape and forms and change control boards you must fight to make your simple change? If you do manage to overcome those hurdles, are you sure that all dates are stored in the same formatting?