Greater than a date : Date « SQL Data Types « Oracle PL/SQL Tutorial






SQL>
SQL> CREATE TABLE titles(
  2    title_id   CHAR(3)      NOT NULL,
  3    title_name VARCHAR(40)  NOT NULL,
  4    type       VARCHAR(10)  NULL    ,
  5    pub_id     CHAR(3)      NOT NULL,
  6    pages      INTEGER      NULL    ,
  7    price      DECIMAL(5,2) NULL    ,
  8    sales      INTEGER      NULL    ,
  9    pubdate    DATE         NULL    ,
 10    contract   SMALLINT     NOT NULL
 11  );

Table created.

SQL>
SQL>
SQL>
SQL>
SQL> INSERT INTO titles VALUES('T01','Java','history','P01',111,21.99,566,DATE '2000-08-01',1);

1 row created.

SQL> INSERT INTO titles VALUES('T02','Oracle','history','P03', 114,19.95,9566,DATE '1998-04-01',1);

1 row created.

SQL> INSERT INTO titles VALUES('T03','SQL','computer','P02', 122,39.95,25667,DATE '2000-09-01',1);

1 row created.

SQL> INSERT INTO titles VALUES('T04','C++','psychology','P04', 511,12.99,13001,DATE '1999-05-31',1);

1 row created.

SQL> INSERT INTO titles VALUES('T05','Python','psychology','P04', 101,6.95,201440,DATE '2001-01-01',1);

1 row created.

SQL> INSERT INTO titles VALUES('T06','JavaScript','biography','P01', 173,19.95,11320,DATE '2000-07-31',1);

1 row created.

SQL> INSERT INTO titles VALUES('T07','LINQ','biography','P03', 331,23.95,1500200,DATE '1999-10-01',1);

1 row created.

SQL> INSERT INTO titles VALUES('T08','C#','children','P04', 861,10.00,4095,DATE '2001-06-01',1);

1 row created.

SQL> INSERT INTO titles VALUES('T09','SQL Server','children','P04', 212,13.95,5000,DATE '2002-05-31',1);

1 row created.

SQL> INSERT INTO titles VALUES('T10','AJAX','biography','P01', NULL,NULL,NULL,NULL,0);

1 row created.

SQL> INSERT INTO titles VALUES('T11','VB','psychology','P04', 821,7.99,94123,DATE '2000-11-30',1);

1 row created.

SQL> INSERT INTO titles VALUES('T12','Office','biography','P01', 507,12.99,100001,DATE '2000-08-31',1);

1 row created.

SQL> INSERT INTO titles VALUES('T13','VBA','history','P03', 812,29.99,10467,DATE '1999-05-31',1);

1 row created.

SQL>
SQL>
SQL>
SQL>
SQL> SELECT title_name, pubdate
  2    FROM titles
  3    WHERE pubdate >= DATE '2001-01-01';

TITLE_NAME                               PUBDATE
---------------------------------------- ---------
Python                                   01-JAN-01
C#                                       01-JUN-01
SQL Server                               31-MAY-02

SQL>
SQL> drop table titles;

Table dropped.

SQL>
SQL>








10.6.Date
10.6.1.Process and store a specific date and time.
10.6.2.Use the DATE keyword to supply a date literal to the database.
10.6.3.Cast string to date in where clause
10.6.4.Setting the Default Date Format
10.6.5.Storing and Retrieving Dates
10.6.6.Default time field
10.6.7.Combining TO_CHAR() and TO_DATE() Calls
10.6.8.Converting a DATE to Another Language
10.6.9.Compare date type value in where clause
10.6.10.Query for NULL Date type data
10.6.11.TRUNC(Start_date)
10.6.12.TO_CHAR(start_date, 'MM-DD-YYYY HH24:MI')
10.6.13.Call SYSDATE in insert statement
10.6.14.Check Date format before inserting
10.6.15.Add condition constraint to date type column
10.6.16.Greater than a date
10.6.17.BETWEEN for date type value
10.6.18.Date calculation