[TDH] commonly used date functions

v_etldate for the time parameter
- find yesterday's date to the current date
the SELECT DATE_ADD (System, -1) from system.dual;
- seeking current date is the first few months of the year
v_etldate_month
the SELECT Cast (substr (v_etldate, 7,1) AS int) system.dual from;
- demand late last year
v_etldate_last_year
the SELECT ADD_MONTHS (LAST_DAY (v_etldate), - v_etldate_month) system.dual from;
- seeking early last year
v_etldate_last_year_beg
the SELECT add_month (v_etldate_last_year, -12) system.dual from;
- seeking the number of days in a year
v_last_year
SELECT DATEDIFF (v_etldate, v_etldate_last_year) from system.dual;

Guess you like

Origin blog.csdn.net/dscfirst/article/details/91538188
Recommended