Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

datepart equivalent in oracle for date function

NeilCSEMay 13 2011 — edited May 14 2011
I was trying to convert the sqlserver query to oracle and found a function which is not available in ora, could you plz help me in converting this

select top 5 ssm.maturity,datepart(mm, dateadd(mm, -3, ssm.maturity)) from sec_ind_ss ssm;

2014-10-23 00:00:00.0	  7
9999-12-31 00:00:00.0	  9
2021-01-02 00:00:00.0	  10
2022-07-31 00:00:00.0	  4
2019-07-31 00:00:00.0	  4


I tried this but no result

SELECT ssm.maturity ,CAST(EXTRACT(MONTH FROM ssm.maturity - NUMTOYMINTERVAL(3,'month')) AS VARCHAR2(30))
from sec_ind_ss ssm WHERE ROWNUM<=5;

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 11 2011
Added on May 13 2011
10 comments
61,561 views