sql - Oracle : specify a larger or smaller in date data type -
i have table with:
- two columns :
date_1
,date_2
- data type
date
(dd-mm-yyyy) - database
oracle
i want know whether date_1
greater
or smaller
date_2
.
my script:
decode (to_char(date_1,'yyyyddmm') > to_char(date_2,'yyyyddmm'), 'greater','smaller') status
cmiiw
as datatype of both date not need convert date char.
select case when date_1 > date_2 'date_1 greater' when date_1 = date_2 'date_1 equal date_2' else 'date_1 smaller' end
Comments
Post a Comment