'database/ORACLE'에 해당되는 글 93건

  1. 2012.02.21 EXTRACT

EXTRACT

database/ORACLE 2012. 2. 21. 20:16
반응형

EXTRACT (
{ YEAR | MONTH | DAY | HOUR | MINUTE | SECOND }
| { TIMEZONE_HOUR | TIMEZONE_MINUTE }
| { TIMEZONE_REGION | TIMEZONE_ABBR }
FROM { date_value | interval_value } )

YEAR | MONTH | DAY 는 DATE 에서 추출 가능.

HOUR | MINUTE | SECOND 는 TIME에서 추출 가능.

나머지는 TIMESTAMP와 TIME ZONE datatype에서 추출가능.

- 예 -
SELECT EXTRACT(YEAR FROM TO_DATE('2010-01-18','YYYY-MM-DD')) AS YEAR
FROM DUAL;

SELECT EXTRACT(MONTH FROM TO_DATE('2010-01-18','YYYY-MM-DD')) AS MONTH
FROM DUAL;

SELECT EXTRACT(DAY FROM TO_DATE('2010-01-18','YYYY-MM-DD')) AS DAY
FROM DUAL;

SELECT EXTRACT(HOUR FROM TIME '19:03:18')
FROM DUAL;

SELECT EXTRACT(MINUTE FROM TIME '19:03:18')
FROM DUAL;

SELECT EXTRACT(SECOND FROM TIME '19:03:18')
FROM DUAL;


 
반응형
Posted by 공간사랑
,