I have a column "PERIOD_ID" in a table which is of Integer type.
I want to assign values in the format YYYYMM (current year and month,(current year and month) -1) to PERIOD_ID.
Example : PERIOD_ID in (201703,201702)
I am able to find the current year and month but not the previous one.
PERIOD_ID = (sel TRIM(EXTRACT(YEAR FROM current_date))||TRIM(CASE WHEN EXTRACT(MONTH FROM current_date) >9 THEN TRIM(EXTRACT(MONTH FROM current_date)) ELSE 0||TRIM(EXTRACT(MONTH FROM current_date))END ))
If I add minus 1 its giving the output "2017 2.00000000000000E 000"
Could any one help me how to implement this.
Thank you in advance.
Solved! Go to Solution.