timestamp格式表示的时间如何转换成普通格式

请教各位大侠:
已知某个数据表的时间字段用timestamp格式表示(精确到秒),例如字段名为oper_date,数据值为:1112295874。请问oracle中有没有什么自带的函数,或者用其它什么方法可以把值转换为我们常见的'yyyymmdd hh24:mi:ss'?
---------------------------------------------------------------

SQL> desc timestamptest;
Name Type Nullable Default Comments
---- ------------ -------- ------- --------
TP TIMESTAMP(6) Y sysdate
ID NUMBER Y

SQL> select * from timestamptest;

TP ID
-------------------------------------------------------------------------------- ----------
18-7月 -05 09.44.54.000000 上午 11
18-7月 -05 09.44.54.000000 上午 11
23-1月 -03 12.00.00.000000 上午 11

SQL> SELECT to_char(tp,'dd-mm-yyyy hh24:mi:ss.ff') FROM TIMESTAMPTEST;

TO_CHAR(TP,'DD-MM-YYYYHH24:MI:
------------------------------
18-07-2005 09:44:54.000000
18-07-2005 09:44:54.000000
23-01-2003 00:00:00.000000

SQL>

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus