【问题标题】:Can somebody explain me why my query is not working? [closed]有人可以解释一下为什么我的查询不起作用吗? [关闭]
【发布时间】:2020-11-20 14:40:40
【问题描述】:
select to_char(current_date,'"q'[Today]'''s date is DD-MM-RRRR"')as output from dual;

【问题讨论】:

  • 你得到什么样的错误信息?
  • 您使用的是哪个 dbms?

标签: sql string oracle datetime


【解决方案1】:

我想这就是你想在ORACLE做的事情:

select to_char(current_date,'"Today''s date is" DD-MM-RRRR')as output from dual;
|输出 | | :------------------------- | |今天的日期是 20-11-2020 |

【讨论】:

  • 提供 cotext 以防止标记为低质量答案。 EOR。
【解决方案2】:

您似乎想将文字字符串与格式化的日期连接起来:

select 'today''s date is ' || to_char(current_date, 'DD-MM-RRRR') as output from dual;

这会产生:

|输出 | | :------------------------- | |今天的日期是 20-11-2020 |

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-26
    • 2016-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-31
    • 1970-01-01
    相关资源
    最近更新 更多