Skip to main content

HOW TO USE ORACLE TIMESTAMP DATATYPE AND ITS CLASSES


TIMESTAMP IN ORACLE
-------------------------------

CREATE TABLE DEMO
(
ID NUMBER PRIMARY KEY,
TD_I TIMESTAMP,
TD_II INTERVAL YEAR TO MONTH, /*Indicates an Interval of Year to Month : eg. Interval of 2 Years, 3 Months.*/
TD_III INTERVAL DAY TO SECOND, /*Indicates an Interval of Day to Second : eg. Interval of 2 Days,5 Hours, 5 Min and 5 Seconds.*/
TD_IV TIMESTAMP WITH LOCAL TIME ZONE, 
TD_V TIMESTAMP WITH TIME ZONE
);

INSERT INTO DEMO(ID,TD_I,TD_II,TD_III,TD_IV,TD_V)
VALUES(1,'01-JAN-2010 12:25 PM','2-3','3 10:10:10','01-AUG-2005 8:00:00 AM','01-AUG-2005 8:00:00 AM +5:30');

select * from demo;

SELECT sysdate,sysdate+TD_II "Future Date",(sysdate+TD_II)-sysdate "Days Difference" FROM DEMO;


Comments

Popular posts from this blog

A Hit Count Using Java Servlet's Session Tracking

import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class SessionTracker extends HttpServlet {         public void doGet(HttpServletRequest req,HttpServletResponse res)         throws ServletException,IOException         {                res.setContentType("text/html");                PrintWriter out=res.getWriter();                HttpSession session=req.getSession(true);                Integer count=(Integer)session.getValue("tracker.count");                if(count==null)       ...

Java Sample: While loop

public class whilechk1 {     public static void main(String args[])     {         int row,column,y;         System.out.print("\nMultiplication Table\n");         row=1;         do         {             column=1;             do             {                 y=row*column;                 System.out.print("\t"+y);                 column++;             }while(column<=10);             System.out.println("\n");             row++;         }while(row<=10);     } }

Hi! I'm Java...

Java is a computer programming language. It enables programmers to write computer instructions using English based commands, instead of having to write in numeric codes. It’s known as a “high-level” language because it can be read and written easily by humans. Like English, Java has a set of rules that determine how the instructions are written. These rules are known as its “syntax”. Once a program has been written, the high-level instructions are translated into numeric codes that computers can understand and execute. Who Created Java? In the early nineties, Java was created by a team led by James Gosling for Sun Microsystems. It was originally designed for use on digital mobile devices, such as cell phones. However, when Java 1.0 was released to the public in 1996, its main focus had shifted to use on the Internet. It provided more interactivity with users by giving developers a way to produce animated webpages . Over the years it has evolved as a successful language for ...