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

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

      <legend id='z8zHr'><style id='z8zHr'><dir id='z8zHr'><q id='z8zHr'></q></dir></style></legend>
      • <bdo id='z8zHr'></bdo><ul id='z8zHr'></ul>

        将 to_char(myDate, 'DAY') 的结果与字符串进行比较时出现问题

        Issue when comparing result of to_char(myDate, #39;DAY#39;) to a string(将 to_char(myDate, DAY) 的结果与字符串进行比较时出现问题)
            1. <i id='pWMdx'><tr id='pWMdx'><dt id='pWMdx'><q id='pWMdx'><span id='pWMdx'><b id='pWMdx'><form id='pWMdx'><ins id='pWMdx'></ins><ul id='pWMdx'></ul><sub id='pWMdx'></sub></form><legend id='pWMdx'></legend><bdo id='pWMdx'><pre id='pWMdx'><center id='pWMdx'></center></pre></bdo></b><th id='pWMdx'></th></span></q></dt></tr></i><div id='pWMdx'><tfoot id='pWMdx'></tfoot><dl id='pWMdx'><fieldset id='pWMdx'></fieldset></dl></div>

            2. <legend id='pWMdx'><style id='pWMdx'><dir id='pWMdx'><q id='pWMdx'></q></dir></style></legend>
                <tbody id='pWMdx'></tbody>

            3. <small id='pWMdx'></small><noframes id='pWMdx'>

                  <bdo id='pWMdx'></bdo><ul id='pWMdx'></ul>
                  <tfoot id='pWMdx'></tfoot>
                  本文介绍了将 to_char(myDate, 'DAY') 的结果与字符串进行比较时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直试图找出可能是什么问题,但我只是运气不好,根本不了解这个问题.我有以下代码:

                  I have been trying to find what the issue might be but I am just out of luck and don't understand this problem at all.I have the following code:

                  CREATE OR REPLACE FUNCTION ckeckDay(dateC in date)
                  RETURN VARCHAR
                  IS
                    day VARCHAR(15);
                    checkFriday VARCHAR(1);
                  BEGIN
                    checkFriday := 'N';
                    day := to_char(dateC, 'DAY');
                    IF day = 'FRIDAY' THEN
                      checkFriday := 'Y';
                    END IF;
                    RETURN day;
                  END;
                  /
                  

                  dateC 设置为 Friday(甚至通过返回 day 而不是 day 变量来测试它并返回 Friday.)但是IF 语句永远不会计算为真,即使 day 变量确实是星期五.任何想法如何解决这个问题.谢谢

                  the dateC is set to Friday (even tested it by returning day instead of the day variable and it returns Friday.) However the IF statement never evaluates to true even though the day variable is indeed Friday.Any ideas how to go around this issue.Thanks

                  推荐答案

                  这是因为 day 变量包含一个空白填充值.使用 trim 函数去除前导和尾随空格:

                  It is because day variable contains a blank padded value. Use trim function to get rid of leading and trailing spaces:

                  IF trim(day) = 'FRIDAY' THEN
                    checkFriday := 'Y';
                  END IF;
                  

                  并且请使用 VARCHAR2 数据类型作为字符串变量.不要使用VARCHAR.

                  And please use VARCHAR2 datatype for string variables. Do not use VARCHAR.

                  这篇关于将 to_char(myDate, 'DAY') 的结果与字符串进行比较时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  How to redirect the output of DBMS_OUTPUT.PUT_LINE to a file?(如何将 DBMS_OUTPUT.PUT_LINE 的输出重定向到文件?)
                  How do I get column datatype in Oracle with PL-SQL with low privileges?(如何使用低权限的 PL-SQL 在 Oracle 中获取列数据类型?)
                  Get a list of all functions and procedures in an Oracle database(获取 Oracle 数据库中所有函数和过程的列表)
                  Why cannot I create triggers on objects owned by SYS?(为什么我不能在 SYS 拥有的对象上创建触发器?)
                  Returning result even for elements in IN list that don#39;t exist in table(即使对于表中不存在的 IN 列表中的元素也返回结果)
                  Reset Sequence in oracle 11g(oracle 11g 中的重置序列)

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

                        <tbody id='kBHbC'></tbody>
                    • <legend id='kBHbC'><style id='kBHbC'><dir id='kBHbC'><q id='kBHbC'></q></dir></style></legend>
                    • <tfoot id='kBHbC'></tfoot>

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