21. 10. 6. MONTHS_BETWEEN |
|
The MONTHS_BETWEEN function is shown here: |
v_nr:= MONTHS_BETWEEN(date1,date2);
|
|
The MONTHS_BETWEEN function returns the number of months between two dates. |
If this difference is not exact, you get a floating-point number. |
The decimal portion represents the fraction N/31 where N is the number of remaining days. |
SQL> declare
2 v_nr number;
3 begin
4 v_nr:=months_between(sysdate,trunc(sysdate,'Y'));
5 DBMS_OUTPUT.put_line(v_nr);
6 end;
7 /
5.28567988351254480286738351254480286738
PL/SQL procedure successfully completed.
SQL>
|
|