Oracle SQL, PLSQL, APEX How To's by Dr. S. Raghunathan - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

 

 

05-Mar-60

 

 

13.03      How to use months_between( ) function

 

img7.png Finding Number of months between two dates 05-mar-2010 and 05-mar-1991

SYNTAX:                      selec months-between( to-date('05-mar-2010'),to-date('05-mar-1991')) "No,of Months" From dual ;

RESULT : No,of Months

 

228

 

Usage of Extract function :

 

13.04  How to extract year from date column

 

SYNTAX:

 

select    extract(YEAR    from    sysdate)    "YEAR", extract(month from sysdate) "MONTH",

extract(DAY from sysdate) "DAY" from dual ; RESULT :

Year   Month Day

 

- - - -   - - - - - - - -

 

2010        6         16