为什么Oracle 10g to_char(日期时间)截断字符串?

前端之家收集整理的这篇文章主要介绍了为什么Oracle 10g to_char(日期时间)截断字符串?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我得到了一个 bug report,其中Oracle 10g从to_char(datetime)截断了返回值:
sql> select to_char(systimestamp,'"day:"DD"hello"') from dual;

TO_CHAR(SYSTIMESTAMP,'"DAY:"DD"HE
---------------------------------
day:27hel

值得注意的是,这似乎不会发生在Oracle 11g.我的问题是,它为什么会发生?是否有一些配置变量设置为告诉to_char(datetime)为其返回值分配更大的缓冲区?

我不确定,但它可能只是在sql * Plus中显示.你试过在Toad中运行吗?或者,如果将结果分配给PL / sql块中的varchar2并输出结果?

这是我在sql * Plus Reference for 10g中找到的:

The default width and format of unformatted DATE columns in sql*Plus
is determined by the database NLS_DATE_FORMAT parameter. Otherwise,
the default format width is A9. See the FORMAT clause of the COLUMN
command for more information on formatting DATE columns.

您的值被修剪为9个字符,对应于默认的A9格式.我没有相同的版本,这种行为不会在11g中复制,所以请你检查一下我的理论吗?

猜你在找的Oracle相关文章