在csv中包含oracle查询结果的日期类型列

时间:2016-04-21 03:45:51

标签: oracle type-conversion xlsx

[修正]

我正在尝试使用oracle中的列标题在xls中获取查询结果

以下是查询

select
'Student Name'
'Joining Date'
from dual 
union all
select 
student_name
to_char(joining_date,'MM/DD/YYYY')
from student_details

唯一的问题是,一旦我在xlsfile中得到它,我就无法使用 joined_date 对数据进行排序,因为它已转换为varchar / char。

我需要一个解决方案,其中我能够包含标题并在最终的xls结果中保留数据类型(日期,数字)。(我可以将excel中的单元格格式化为日期/数字但我希望通过数据库查询本身)

请帮忙!

1 个答案:

答案 0 :(得分:0)

以Oracle文字提取数据:

1) numbers - 123.354 

2) strings - q'{This is a string}' / 'This is another string'

3) dates - DATE'2016-04-31' 

4) dates with time/timestamps - TIMESTAMP'2016-04-31 11:13:00'/TIMESTAMP'2016-04-31 11:13:00.000000'