Convert a numeric or date expression to a character String.
Syntax
EXTRACT (type FROM datetime | interval)
Key
Types that can be extracted:
YEAR
MONTH
DAY
HOUR
MINUTE
SECOND
TIMEZONE_HOUR
TIMEZONE_MINUTE
TIMEZONE_REGION
TIMEZONE_ABBR
Examples
SQL> SELECT EXTRACT(YEAR FROM DATE '2009-01-04') FROM dual; SQL> Select expiry_date,
Extract(YEAR from expiry_date) YR,
Extract(month from expiry_date) MTH
From dba_users
Where expiry_date is not null; SQL> select to_char(sysdate,'HH24:MI:SS') "Time Now" from dual; '14:35:56'
Related
TO_DATE - Convert to a date
TO_NUMBER - Convert to numeric format
CONVERT - Convert a string from one character set to another.
SQL Functions - Oracle SQL
ORA-00932 inconsistent datatypes
© Copyright SS64.com 1999-2013
Some rights reserved