Remember That Dates Are Numbers : DATE « PL SQL Data Types « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » PL SQL Data Types » DATE 
21. 6. 18. Remember That Dates Are Numbers

Finding the Difference between Dates.

SQL>
SQL> create or replace function f_secBetween_nr (i_date1_dt DATE,i_date2_dt DATE)
  2  return NUMBER is
  3      v_ret_nr NUMBER;
  4  begin
  5      v_ret_nr:=i_date1_dt-i_date2_dt;
  6      return v_ret_nr*(24*60*60);
  7  end f_secBetween_nr;
  8  /

Function created.

SQL> select f_secBetween_nr(sysdate, sysdate +1from dual
  2  /

F_SECBETWEEN_NR(SYSDATE,SYSDATE+1)
----------------------------------
                            -86400
21. 6. DATE
21. 6. 1. DATE
21. 6. 2. Define DATE type variable
21. 6. 3. Date literals
21. 6. 4. Displaying Date and Time
21. 6. 5. Using the DATE Format Mask
21. 6. 6. Using Format Masks mixed with user string
21. 6. 7. Assignment value to DATE type variable during declaration
21. 6. 8. Use SYSDATE to initialize an DATE type variable
21. 6. 9. Define DATE type variable, assign value TRUNC(SYSDATE)
21. 6. 10. Use FOR LOOP to loop through dates
21. 6. 11. Compare DATE type variable in IF statement
21. 6. 12. Compare DATE type variable after truncating
21. 6. 13. Combine TO_NUMBER and TO_DATE to get different parts of a Date
21. 6. 14. Performing Calculations on a Converted Date
21. 6. 15. Converting DATE to a Spelled-Out Character Format
21. 6. 16. Calculate the months between two dates
21. 6. 17. Use the date value back and forth
21. 6. 18. Remember That Dates Are Numbers
21. 6. 19. Check the last date that a date type variable can hold
21. 6. 20. Use the new EXTRACT function to grab individual year and month components.
21. 6. 21. ROUND function being applied to datetime values
21. 6. 22. TO_CHAR(C,'YYYY-MM-DD HH:MI:SS.FF AM TZH:TZM TZR TZD')
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.