尝试转换Varchar2列并使用BIP报告检索数据时获取Oracle错误

发布于 2025-01-31 13:03:43 字数 700 浏览 2 评论 0 原文

我们在oracle表中有列(字段)属性14,该列表的数据类型varchar2,并以格式存储日期 '20 -may-22' dd-mon-yy )。

我们需要在Oracle Fusion中开发BIP报告,并根据传递的参数日期获取输出。如果没有参数为基于所有记录。

但是,众所周知,Oracle数据集或BIP报告中的任何日期参数都将处于以下格式。

日期参数:'2021-12-05T19:00:00.000-05:00'

以及在通过以下错误时尝试以下查询时。

select *
from   ab cet
where  1=1
AND    TO_DATE(cet. attribute14, DD-MON-YY NLS_date_language=AMERICAN")
         IN ( nvl(:void_date.TO_DATE(cet.attribute14, DD-MON-YY.NLS_date_language=AMERICAN")))

当参数值传递时,以下错误出现。

Error: ORA-01847: day of the month must be between 1 and the last day of the month.

We have column (field) attribute14 in the oracle table which is of data type VARCHAR2 and is storing date in format '20-MAY-22' (DD-MON-YY).

We have a requirement to develop a BIP report in oracle fusion and get output based on the parameter date passed & if no parameter is based then all the records.

But as we all know any date parameter in the oracle Data set or BIP report will be in the below format.

Date Parameter: '2021-12-05T19:00:00.000-05:00'

And upon trying the below query when the parameter is passed the following error.

select *
from   ab cet
where  1=1
AND    TO_DATE(cet. attribute14, DD-MON-YY NLS_date_language=AMERICAN")
         IN ( nvl(:void_date.TO_DATE(cet.attribute14, DD-MON-YY.NLS_date_language=AMERICAN")))

The below error comes when the parameter value is passed.

Error: ORA-01847: day of the month must be between 1 and the last day of the month.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听闻余生 2025-02-07 13:03:43

您需要在日期格式附近使用单个引号。看来您的语言也不正确。详细信息可以在Oracle文档中阅读。这是一个简单的示例。

SELECT TO_DATE(
    '20-MAY-22',
    'DD-MON-YY',
    'NLS_DATE_LANGUAGE = American')
FROM DUAL;

You need to use single quotes around the date format. Seems your language is also incorrect. Details can be read in the Oracle documentation. Here is a simple example.

SELECT TO_DATE(
    '20-MAY-22',
    'DD-MON-YY',
    'NLS_DATE_LANGUAGE = American')
FROM DUAL;

https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions183.htm

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文