<bdo id='SSfqV'></bdo><ul id='SSfqV'></ul>
    <i id='SSfqV'><tr id='SSfqV'><dt id='SSfqV'><q id='SSfqV'><span id='SSfqV'><b id='SSfqV'><form id='SSfqV'><ins id='SSfqV'></ins><ul id='SSfqV'></ul><sub id='SSfqV'></sub></form><legend id='SSfqV'></legend><bdo id='SSfqV'><pre id='SSfqV'><center id='SSfqV'></center></pre></bdo></b><th id='SSfqV'></th></span></q></dt></tr></i><div id='SSfqV'><tfoot id='SSfqV'></tfoot><dl id='SSfqV'><fieldset id='SSfqV'></fieldset></dl></div>

    <legend id='SSfqV'><style id='SSfqV'><dir id='SSfqV'><q id='SSfqV'></q></dir></style></legend><tfoot id='SSfqV'></tfoot>

    1. <small id='SSfqV'></small><noframes id='SSfqV'>

      Oracle 的默认日期格式是 YYYY-MM-DD,为什么?

      时间:2023-09-18

        <tbody id='IwY0P'></tbody>
        <legend id='IwY0P'><style id='IwY0P'><dir id='IwY0P'><q id='IwY0P'></q></dir></style></legend>
            <tfoot id='IwY0P'></tfoot>
            • <i id='IwY0P'><tr id='IwY0P'><dt id='IwY0P'><q id='IwY0P'><span id='IwY0P'><b id='IwY0P'><form id='IwY0P'><ins id='IwY0P'></ins><ul id='IwY0P'></ul><sub id='IwY0P'></sub></form><legend id='IwY0P'></legend><bdo id='IwY0P'><pre id='IwY0P'><center id='IwY0P'></center></pre></bdo></b><th id='IwY0P'></th></span></q></dt></tr></i><div id='IwY0P'><tfoot id='IwY0P'></tfoot><dl id='IwY0P'><fieldset id='IwY0P'></fieldset></dl></div>
            • <small id='IwY0P'></small><noframes id='IwY0P'>

                <bdo id='IwY0P'></bdo><ul id='IwY0P'></ul>
              • 本文介绍了Oracle 的默认日期格式是 YYYY-MM-DD,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                Oracle 的默认日期格式是 YYYY-MM-DD.这意味着如果我这样做:

                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 my date.

                是的,我知道你可以修复"这个问题:

                Yes, I know you can "fix" this with:

                 alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
                

                但是说真的,为什么上面不是默认的?特别是在 DBMS 中,两种主要的时间跟踪数据类型(DATE 和 TIMESTAMP)具有包括(至少)精度低至 1 秒的时间组件.

                But seriously, why isn't the above the default? Especially in a DBMS where the two primary time-tracking data types (DATE and TIMESTAMP) both have a time component that includes (at least) accuracy down to 1 second.

                推荐答案

                如果您使用此查询为数据仓库生成输入文件,则需要适当地格式化数据.基本上在这种情况下,您将日期(确实有时间组件)转换为字符串.您需要明确格式化您的字符串或更改您的 nls_date_format 以设置默认值.在您的查询中,您可以简单地执行以下操作:

                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;
                

                这篇关于Oracle 的默认日期格式是 YYYY-MM-DD,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:命令行中的 sqlplus 语句 下一篇:oracle 给现有表添加自增主键

                相关文章

              • <tfoot id='WSuUr'></tfoot>

                    <bdo id='WSuUr'></bdo><ul id='WSuUr'></ul>

                    <small id='WSuUr'></small><noframes id='WSuUr'>

                  1. <legend id='WSuUr'><style id='WSuUr'><dir id='WSuUr'><q id='WSuUr'></q></dir></style></legend>

                    <i id='WSuUr'><tr id='WSuUr'><dt id='WSuUr'><q id='WSuUr'><span id='WSuUr'><b id='WSuUr'><form id='WSuUr'><ins id='WSuUr'></ins><ul id='WSuUr'></ul><sub id='WSuUr'></sub></form><legend id='WSuUr'></legend><bdo id='WSuUr'><pre id='WSuUr'><center id='WSuUr'></center></pre></bdo></b><th id='WSuUr'></th></span></q></dt></tr></i><div id='WSuUr'><tfoot id='WSuUr'></tfoot><dl id='WSuUr'><fieldset id='WSuUr'></fieldset></dl></div>