- 카테고리:
EXTRACT¶
Extracts the specified date or time part from a date, interval, time, or timestamp.
팁
타임스탬프에서 날짜를 추출하려면 TO_DATE 함수를 사용합니다.
구문¶
인자¶
date_or_time_partThe unit of time. Must be one of the values listed in 지원되는 날짜 및 시간 부분 (for example,
month). The value can be a string literal or can be unquoted (for example,'month'ormonth).date_or_time_part이week(또는 그 변형)인 경우, 출력은 WEEK_START 세션 매개 변수에 의해 제어됩니다.date_or_time_part가dayofweek또는yearofweek(또는 그 변형)인 경우, 출력은 WEEK_OF_YEAR_POLICY 및 WEEK_START 세션 매개 변수에 의해 제어됩니다.
예를 포함한 자세한 내용은 달력상의 주 및 요일 을 참조하십시오.
date_interval_time_or_timestamp_exprA date, an interval, a time, or a timestamp, or an expression that can be evaluated to one of those data types.
반환¶
NUMBER 데이터 타입의 값을 반환합니다.
사용법 노트¶
When
date_interval_time_or_timestamp_expris a year-month interval value, the supporteddate_or_time_partvalues areyearandmonth.When
date_interval_time_or_timestamp_expris a day-time interval value, the supporteddate_or_time_partvalues areday,hour,minute,second, andnanosecond.Currently, when
date_interval_time_or_timestamp_expris a DATE value, the followingdate_or_time_partvalues aren’t supported:epoch_millisecondepoch_microsecondepoch_nanosecond
다른 날짜 및 시간 부분 (
epoch_second포함)이 지원됩니다.
예¶
타임스탬프에서 연도를 추출할 year 부분을 지정합니다.
DECODE 함수와 함께 EXTRACT를 사용하고 dayofweek 부분을 사용하여 현재 요일의 전체 이름을 반환합니다.
참고
출력은 쿼리를 실행할 때 SYSTIMESTAMP 함수가 반환하는 값에 따라 달라집니다. 또한 DAYNAME 함수를 사용하여 지정된 날짜 또는 타임스탬프에서 세 글자로 된 요일 이름을 추출할 수도 있습니다.