INTERVAL DAY(3) TO SECOND (4) : INTERVAL « Date Timezone « Oracle PL / SQL






INTERVAL DAY(3) TO SECOND (4)



SQL> CREATE TABLE promotions (
  2    promotion_id INTEGER,
  3    name VARCHAR2(30),
  4    duration INTERVAL DAY(3) TO SECOND (4)
  5  );

Table created.

SQL>
SQL>
SQL> INSERT INTO promotions (promotion_id, name, duration)
  2  VALUES (1, '10% off Z Files', INTERVAL '3' DAY);

1 row created.

SQL> INSERT INTO promotions (promotion_id, name, duration)
  2  VALUES (2, '20% off Pop 3', INTERVAL '2' HOUR);

1 row created.

SQL> INSERT INTO promotions (promotion_id, name, duration)
  2  VALUES (3, '30% off Modern Science', INTERVAL '25' MINUTE);

1 row created.

SQL> INSERT INTO promotions (promotion_id, name, duration)
  2  VALUES (4, '20% off Tank War', INTERVAL '45' SECOND);

1 row created.

SQL> INSERT INTO promotions (promotion_id, name, duration)
  2  VALUES (5, '10% off Chemistry', INTERVAL '3 2:25' DAY TO MINUTE);

1 row created.

SQL> INSERT INTO promotions (promotion_id, name, duration)
  2  VALUES (6, '20% off Creative Yell',
  3   INTERVAL '3 2:25:45' DAY TO SECOND);

1 row created.

SQL> INSERT INTO promotions (promotion_id, name, duration)
  2  VALUES (7, '15% off My Front Line',
  3   INTERVAL '123 2:25:45.12' DAY(3) TO SECOND(2));

1 row created.

SQL>
SQL> SELECT *
  2  FROM promotions;

PROMOTION_ID NAME                           DURATION
------------ ------------------------------ ---------------------------------------------------------------------------
           1 10% off Z Files                +003 00:00:00.0000
           2 20% off Pop 3                  +000 02:00:00.0000
           3 30% off Modern Science         +000 00:25:00.0000
           4 20% off Tank War               +000 00:00:45.0000
           5 10% off Chemistry              +003 02:25:00.0000
           6 20% off Creative Yell          +003 02:25:45.0000
           7 15% off My Front Line          +123 02:25:45.1200

7 rows selected.

SQL>
SQL> drop table promotions;

Table dropped.

SQL>
SQL>
           
       








Related examples in the same category

1.Using the INTERVAL YEAR TO MONTH Type
2.INTERVAL YEAR(3) TO MONTH
3.INTERVAL DAY TO SECOND type to store time intervals measured in days and seconds
4.INTERVAL DAY TO SECOND
5.Use date time Interval type: interval day(1) to second(2)