Use the date value back and forth : 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. 17. Use the date value back and forth
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2     v_sysdate DATE := SYSDATE;
  3     v_date DATE;
  4     v_char VARCHAR2(20);
  5  BEGIN
  6
  7     
  8     DBMS_OUTPUT.PUT_LINE('Today''s Date: '||v_sysdate);
  9
 10     
 11     v_char := TO_CHAR(v_sysdate, 'DD:MM:YYYY HH24:MI:SS');
 12     DBMS_OUTPUT.PUT_LINE('Display as CHARACTER DD:MM:YYYY HH24:MI:SS: '||v_char);
 13
 14     
 15     v_date := TO_DATE(v_char, 'DD:MM:YYYY HH24:MI:SS');
 16     DBMS_OUTPUT.PUT_LINE('Convert back to DATE format: '||v_date);
 17
 18  END;
 19  /
Today's Date: 03-JUN-07
Display as CHARACTER DD:MM:YYYY HH24:MI:SS: 03:06:2007 21:03:59
Convert back to DATE format: 03-JUN-07

PL/SQL procedure successfully completed.

SQL>
SQL>
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.