Use to_yminterval in PL/SQL : TO_YMINTERVAL « Date Timezone « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » Date Timezone » TO_YMINTERVAL 




Use to_yminterval in PL/SQL
 
SQL>
SQL>
SQL>  declare
  2      l_hiredate timestamp := to_timestamp('1996-11-04 07:00:00','YYYY-MM-DD HH24:MI:SS');
  3      l_oneyr    interval year to month := to_yminterval('01-00');
  4      l_18mos    interval year to month := to_yminterval('01-06');
  5      l_threeyrs interval year to month := to_yminterval('03-00');
  6      l_fiveyrs  interval year to month := to_yminterval('05-00');
  7    begin
  8      dbms_output.put_line('One Year: '||(l_hiredate + l_oneyr));
  9      dbms_output.put_line('One + 1/Year: '||(l_hiredate + l_oneyr));
 10      dbms_output.put_line('Three Years: '||(l_hiredate + l_threeyrs));
 11      dbms_output.put_line('Five Years: '||(l_hiredate + l_fiveyrs));
 12    end;
 13    /
One Year: 04-NOV-97 07.00.00.000000000 AM
One + 1/Year: 04-NOV-97 07.00.00.000000000 AM
Three Years: 04-NOV-99 07.00.00.000000000 AM
Five Years: 04-NOV-01 07.00.00.000000000 AM

PL/SQL procedure successfully completed.

SQL>
SQL> --

 














Related examples in the same category
1.TO_YMINTERVAL(x): Converts the string x to an INTERVAL YEAR TO MONTH
2.Date + to_yminterval('01-05')
3.to_yminterval('00-01')
4.to_yminterval('01-05')
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.