Oracle

Datetime Data Types (2)

Figo Kim 2006. 9. 2. 23:14
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
  • The INTERVAL YEAR TO MONTH data type stores a period of time using the YEAR and MONTH datetime fields
    INTERVAL YEAR [(year_precision)] TO MONTN
    ex)
    CREATE TABLE time_example2
    (loan_duration INTERVAL YEAR(3) TO MONTH );

    INSERT INTO time_example (loan_duration)
    VALUE (INTERVAL '120' MONTH));


    SELECT TO_CHAR (sysdate +loan_duration, 'dd-mon-yyyy')
    FROM time_example2;

















  • The INTERVAL DAY TO SECOND data type stores a period of time in terms of days, hours, minutes, and seconds:
    INTERVAL DAY [(day_precision)]
    TO SECOND [(fractional_second_precision)]

    ex)
    INTERVAL '4 5:12:10.222' DAY TO SECOND(3)
    -> Indicate 4 days, 5 hours, 12 minutes, 10 seconds, and 222 thousandths of a second.
    INTERVAL '180' DAY(3) : Indicate 180 days

    CREATE TABLE time_example3
    (day_duration INTERVAL DAY(3) TO SECOND);

    INSERT INTO time_example3 (day_duration)
    VALUES (INTERVAL '180' DAY(3));

    SELECT sysdate + day_duration "Half Year"
    FROM time_example3;


'Oracle' 카테고리의 다른 글

CHECT Constraint  (0) 2006.09.03
Datetime Data Types (2)  (0) 2006.09.02
Datetime Data Types (1)  (0) 2006.09.02
Datetime Data Types (1)  (0) 2006.09.02
Data Type  (0) 2006.09.02