Use to_date function with between ... and : TO_Date « Data Type « Oracle PL / SQL






Use to_date function with between ... and

 
SQL> CREATE TABLE sales(
  2    product_id            NUMBER(6),
  3    cid           NUMBER,
  4    time_id               DATE,
  5    channel_id            CHAR(1),
  6    promo_id              NUMBER(6),
  7    sold         NUMBER(3),
  8    amount                NUMBER(10,2),
  9    cost                  NUMBER(10,2)
 10  );

Table created.

SQL>
SQL> select sum(amount)
  2  from sales
  3  where time_id between to_date('2006-02-01', 'YYYY-MM-DD') and to_date('2006-02-28', 'YYYY-MM-DD');



SUM(AMOUNT)
-----------

1 row selected.

SQL>
SQL> drop table sales;

Table dropped.

   
  








Related examples in the same category

1.MONTHS_BETWEEN with to_date function
2.Converting spelled date to DATE format
3.Converting number representation to DATE format
4.TO_CHAR(TO_DATE('04-JUL-15', 'DD-MON-YY'), 'DD-MON-YYYY')
5.TO_DATE('04-JUL-15', 'DD-MON-RR'): Uses the RR format when interpreting the years 15 and 75