Hello
I have a column with a DATE format;
I need to format the output, but using the <select> query of this determined column.
I must use ( due to my VC++ program requirements) the next command:
select * from MY_TABLE
Using only this statement the output format is YY-MM-DD and I need YY-MM-DD-HH-MM-SS.
I know how to use TO_CHAR and in fact using SQL*Plus works well.
It's possible to format a column inside the <select * from MY_TABLE> statement?
Thanks

解决方案 »

  1.   

    在c++中使用OCI对数据库进行操作。
    问题:
    对date类型的处理好像有些问题,select过来的date字段数据,都缺少了时、分、秒信息,只能精确到天请高手帮忙分析下,谢谢!
      

  2.   

    oracle 的date类型也是带时分秒的啊?
    有什么问题呢?
    和下面的语句不是样能处理吗?
    select to_char(sysdate,'yyyymmddhh24miss') from dual
      

  3.   

    楼上的没错,很简单!在构造SQL语句,
    在select时,使用to_char()
    在insert时,使用to_date(),
    两函数使用相同的时间格式'YYYY-MM-DD HH24:MI:SS'
    或者其它格式搞定!