全部博文(47)
分类: Oracle
2008-03-25 15:09:10
Convert Datatype To String | TO_CHAR( |
SELECT TO_CHAR(SYSDATE, 'MM/DD/YYYY HH:MI:SS') FROM dual; | |
Converts DATE and TIMESTAMP to VARCHAR2 with the specified format | TO_DATE( |
SELECT TO_CHAR(datecol1, 'DAY-MONTH-YY') COL1, TO_CHAR(datecol2, 'D-MM/YYYY HH24:MI:SS') COL2, TO_CHAR(datecol2, 'YYYY-MON-DD HH24') COL3 FROM t; | |
Demo of FM Formatting From Tom Kyte (Oracle Magazine 3-4/2004) | SELECT TO_CHAR(dt, 'HH:MI AM') A, TO_CHAR(dt, 'FMHH:MI AM') B, TO_CHAR(dt, 'FMHHFM:MI AM') C FROM (SELECT TO_DATE('09:01 am', 'HH:MI AM') dt FROM dual); |
Convert NUMBER to CHARACTER | TO_CHAR(number) |
SELECT TO_CHAR(123) FROM dual; | |
Convert NUMBER to HEX | TO_CHAR(NUMBER) RETURN HEX |
SELECT TO_CHAR(1048576,'XXXXXXXX') FROM dual; | |