I tried to migrate this sentence sql from Sybase to Oracle but I don't now how to implement
dateadd
and datepart
.
select @v_date = convert(char,convert(char(4),datepart(year, dateadd(month, -13, getdate()))) + "/" +
right(( "00" + convert(varchar(2), datepart(month, dateadd(month, -13, getdate())))) , 2) + "/01", 112)
I have searched and know Oracle uses interval
but I still don't understand how.
I'm not a Sybase person, but I'm working on the assumption from the code that you want the start of the month that was 13 months ago.
In which case, its:
SQL> select trunc(add_months(sysdate,-13),'MM') from dual;
TRUNC(ADD
---------
01-OCT-20