Oracle's default date format is YYYY-MM-DD, WHY?

后端 未结 12 2509
温柔的废话
温柔的废话 2020-11-29 00:44

Oracle\'s default date format is YYYY-MM-DD. Which means if I do:

 select some_date from some_table

...I lose the time portion of

12条回答
  •  长情又很酷
    2020-11-29 01:21

    If you are using this query to generate an input file for your Data Warehouse, then you need to format the data appropriately. Essentially in that case you are converting the date (which does have a time component) to a string. You need to explicitly format your string or change your nls_date_format to set the default. In your query you could simply do:

    select to_char(some_date, 'yyyy-mm-dd hh24:mi:ss') my_date
      from some_table;
    

提交回复
热议问题