How do I calculate the years from Jan 1st 1990 until today's date in Oracle SQL? -
how this, without getting negative value.?
sysdate gives current date.
using extract:
sql> select extract(year sysdate) - 1990 years dual; years ---------- 25
or,
using months_between , floor:
sql> select floor(months_between(sysdate, to_date('01/01/1990','mm/dd/yyyy')) /12) 2 "years" 3 dual; years ---------- 25
Comments
Post a Comment