在Oracle的to_char中转义非格式字符的最佳方法是什么? [英] What is the best way to escape non-format characters in Oracle's to_char?

查看:179
本文介绍了在Oracle的to_char中转义非格式字符的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在select语句中打印日期,但是我需要在输出中添加一个字母:

I am trying to print a date in a select statement, but I need to add a letter to the output:

to_char(date_updated, 'YYYY-MM-DDTHH:mm:ss')

Oracle不喜欢T.我只希望T像冒号和破折号一样输出.我可以用反斜杠或其他符号将其转义吗?

Oracle does not like the T. I just want the T to be output like the colons and the dashes. Can I escape it with a backslash or something?

推荐答案

您只需要在其周围加上双引号即可:

You just need double-quotes around it:

to_char(date_updated, 'YYYY-MM-DD"T"HH:mm:ss')

这篇关于在Oracle的to_char中转义非格式字符的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆