INTERVAL DAY TO SECOND : INTERVAL « Date Timezone « Oracle PL / SQL






INTERVAL DAY TO SECOND

 
SQL>
SQL> create table employee(
  2        employee_id number,
  3        break_reason varchar2(100),
  4        break_time interval day(1) to second(2));

Table created.

SQL>
SQL> insert into employee ( employee_id, break_reason, break_time )
  2      values ( 100, 'C',
  3               TIMESTAMP '2001-09-03 12:47:00.000000' -
  4               TIMESTAMP '2001-09-03 13:13:00.000000' );

1 row created.

SQL>
SQL> insert into employee ( employee_id, break_reason, break_time )
  2      values ( 100, 'B',
  3               TIMESTAMP '2001-09-03 13:35:00.000000' -
  4               TIMESTAMP '2001-09-03 13:39:00.000000' );

1 row created.

SQL>
SQL> insert into employee ( employee_id, break_reason, break_time )
  2      values ( 100, 'P',
  3               TIMESTAMP '2001-09-03 16:30:00.000000' -
  4               TIMESTAMP '2001-09-03 17:00:00.000000' );

1 row created.

SQL>
SQL> insert into employee ( employee_id, break_reason, break_time )
  2      values ( 100, 'F',
  3               TIMESTAMP '2001-09-03 17:00:00.000000' -
  4               TIMESTAMP '2001-09-03 17:30:00.000000' );

1 row created.

SQL>
SQL> column break_reason format a30
SQL> column break_time format a30
SQL> select employee_id, break_reason, break_time from employee;

EMPLOYEE_ID BREAK_REASON                   BREAK_TIME
----------- ------------------------------ ------------------------------
        100 C                              -0 00:26:00.00
        100 B                              -0 00:04:00.00
        100 P                              -0 00:30:00.00
        100 F                              -0 00:30:00.00

SQL>
SQL> drop table employee;

Table dropped.

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(3) TO SECOND (4)
5.Use date time Interval type: interval day(1) to second(2)