In one of the table in Oracle application, we were storing date value in VARCHAR2 column (ATTRIBUTE1-15). I was saving date in YYYYMMDD format. Oracle Value set FND_STANDARD_DATE save set in YYYY/MM/DD HH24:MI:SS format.
My custom program did not fail when converted to DATE using to_date function. So I tired following queries and all of them completed without any error. It seems to_date function does not care about separator (i.e. / Or - or NULL).
select to_date('20190721' , 'YYYY/MM/DD HH24:MI:SS') from dual;
select to_date('201907/21', 'YYYY/MM/DD HH24:MI:SS') from dual;
select to_date('04JUL19' , 'DD-MON-YY HH24:MI:SS' ) from dual;
select to_date('04/JUL/19', 'DD-MON-YY HH24:MI:SS' ) from dual;
select to_date('04|JUL-19', 'DD-MON-YY HH24:MI:SS' ) from dual;
Thursday, April 11, 2019
Date Formats in Oracle SQL
Labels:
Sqlplus Tricks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment