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

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

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

        • <bdo id='GHxxO'></bdo><ul id='GHxxO'></ul>

        将日期与预定义格式 pl sql 进行比较

        comparing date with a predefined format pl sql(将日期与预定义格式 pl sql 进行比较)
        <tfoot id='MYQst'></tfoot>
        <i id='MYQst'><tr id='MYQst'><dt id='MYQst'><q id='MYQst'><span id='MYQst'><b id='MYQst'><form id='MYQst'><ins id='MYQst'></ins><ul id='MYQst'></ul><sub id='MYQst'></sub></form><legend id='MYQst'></legend><bdo id='MYQst'><pre id='MYQst'><center id='MYQst'></center></pre></bdo></b><th id='MYQst'></th></span></q></dt></tr></i><div id='MYQst'><tfoot id='MYQst'></tfoot><dl id='MYQst'><fieldset id='MYQst'></fieldset></dl></div>
      1. <small id='MYQst'></small><noframes id='MYQst'>

        <legend id='MYQst'><style id='MYQst'><dir id='MYQst'><q id='MYQst'></q></dir></style></legend>

              <bdo id='MYQst'></bdo><ul id='MYQst'></ul>
                <tbody id='MYQst'></tbody>

                1. 本文介绍了将日期与预定义格式 pl sql 进行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个函数,它应该接受 DD-MON-YY 格式的日期,并且应该以 DD-MM-YYYY 格式显示.我创建的函数是:

                  I have a function which should accept date in a format DD-MON-YY and should display in the format DD-MM-YYYY. The function I have created is :

                  create or replace function PRINT_IT(abc date)
                  RETURN DATE
                  IS
                    v_date DATE;
                  BEGIN
                    if regexp_like(abc,'^[0-9]{2}-[a-z]{3}-[0-9]{2}$')
                    then
                      v_date := TO_DATE(abc,'DD-MM-YYYY');
                    else
                      dbms_output.put_line('wrong format');
                    end if;
                    dbms_output.put_line('The date is ');
                    return v_date;
                  END PRINT_IT;
                  

                  但是返回的值总是错误的日期格式!!

                  but the value returned is always wrong date format!!

                  推荐答案

                  不,不是.您的日期以您的 NLS_DATE_FORMAT<指定的格式输出/a>.如果不同,我想显示然后为您的会话更改此参数:

                  No, it's not. Your date is being output in the format specified by your NLS_DATE_FORMAT. I you want to display if differently then change this parameter for your session:

                  alter session set nls_date_format = 'dd-mm-yyyy'
                  

                  注意显示这个词.这就是所有这些.这就是你应该考虑做的所有事情.日期的显示方式绝不会影响它的存储方式.

                  Note the word display. That's all this does. That's all you should consider doing. The way a date is displayed in no way effects the way it is stored.

                  通常情况下,您可能会使用 TO_CHAR() 使用适当的格式模型来显示日期,即 to_char(my_date, 'dd-mm-yyyy').它将不再是一个日期而是一个字符.

                  More normally you might use TO_CHAR() with an appropriate format model to display a date, i.e. to_char(my_date, 'dd-mm-yyyy'). It will no longer be a date but a character.

                  您似乎不想像您所说的那样显示日期.您正在从函数中返回值,在这种情况下,我会坚持使用您拥有的值.将日期从数据库中取出时,只需将其转换为合适的格式即可显示,始终将其作为日期存储在数据库中.这反过来意味着它存储在数据库中时的样子并不重要,只要它实际上是一个日期即可.

                  It doesn't look like you want to display a date as you've said. You're returning the value from your function, in which case I would stick with what you have. You only need to transform a date into an appropriate format for display when taking it out of the database, always store it as a date in the database. This in turn means that it doesn't matter what it looks like when stored in the database, merely that it is actually a date.

                  这篇关于将日期与预定义格式 pl sql 进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  How to select the first row for each group in MySQL?(如何在MySQL中为每个组选择第一行?)
                  MySQL - Fetching lowest value(MySQL - 获取最低值)
                  Add and link mysql libraries in a cmakelist.txt(在 cmakelist.txt 中添加和链接 mysql 库)
                  What is a good database design (schema) for a attendance database?(考勤数据库的良好数据库设计(架构)是什么?)

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

                    • <legend id='KBxce'><style id='KBxce'><dir id='KBxce'><q id='KBxce'></q></dir></style></legend>
                        <tbody id='KBxce'></tbody>
                    • <small id='KBxce'></small><noframes id='KBxce'>

                      • <bdo id='KBxce'></bdo><ul id='KBxce'></ul>