可能有很多重复,但我面临一个典型的问题,我正在保存数据使用 systimestamp 一个例子是存储的数据就是这个27-MAY-13 09.00.39.169849000 AM -04:00
我想以 dd-mon-yyyy 格式检索这些数据,我正在使用以下查询来执行此操作
TO_DATE(TRUNC( DATE_COLUMN),'dd-mon-yyyy') from sometable
我得到的结果如下 25-MAR-13
但我希望它是 2013 年 3 月 25 日,任何人都可以帮助我的数据库是 oracle 11g 还是 10g 不确定
@cade
我有一个小问题我不能像你说的那样使用查询,因为我有子查询 sql outllook 像这样
WITH C AS (
select
rtrim (xmlagg (xmlelement (e, TRIM(VALUE_TX) || '#') order by field_id ).extract ('//text()'), ',') somedat,
date_colum
FROM (
SELECT form some table)
select First_Name as "First Name",Last_Name as "Last Name",EMAIL,Mobile_Phone as "Mobile Phone",Submitted as "Submitted On"
from (
SELECT SUBSTR(c.somedat,0,INSTR(c.somedata,'#',1,1)-1) AS First_Name,
SUBSTR(c.somedata,INSTR(c.somedata,'#',1,1)+1,INSTR(c.somedata,'#',1,2)-INSTR(c.somedata,'#',1,1)-1) AS Last_Name,
SUBSTR(c.somedata,INSTR(c.somedata,'#',1,2)+1,INSTR(c.somedata,'#',1,3)-INSTR(c.somedata,'#',1,2)-1) AS Mobile_Phone,
SUBSTR(c.somedata,INSTR(c.somedata,'#',1,3)+1,INSTR(c.somedata,'#',1,4)-INSTR(c.somedata,'#',1,3)-1) AS EMAIL
to_char(TRUNC( C.date_colum),'dd-mon-yyyy') AS Submitted
FROM C)
order by 5 asc