 |
|
Oracle to_char usage
Oracle Tips by Burleson Consulting |
The Oracle to_char SQL function is used to
transform a DATE or NUMBER datatype into a displayable text string.
to_char(number_type, format_mask)
From the Oracle
docs, we see the formats for the Oracle to_char format mask:

Examples of the Oracle SQL to_char function
might include:
to_char(sum(decode(substr(time,10,2),'23',1,0)),'99')
to_char(sn.begin_interval_time,'hh24')
TO_CHAR(BID.START_DATE, 'dd mon yyyy') || ' to ' ||
TO_CHAR(BID.END_DATE, 'dd mon yyyy')
to_char(begin_interval_time,'yyyy-mm-dd hh24:mi')
TO_CHAR(
COLUMN_NAME,'DD-MON-RRRR HH24:MI:SS' )
SELECT
TO_CHAR(SYSDATE,'dd-Mon-yyyy hh:mi:ss PM') FROM dual;
My example pages using the to_char function:
 |
If you like Oracle tuning, you may enjoy my new book "Oracle
Tuning: The Definitive Reference", over 900 pages
of BC's favorite tuning tips & scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |
|