简体   繁体   English

COGNOS:在 Cognos 中将 SQL 日期提示转换为日期提示

[英]COGNOS: Convert SQL date prompt to date prompt in Cognos

I currently have a problem to convert an SQL date prompt in Cognos.我目前在 Cognos 中转换 SQL 日期提示时遇到问题。 I would like to rebuild a SQL-Query into Cognos Report Studio 10.2.我想将 SQL 查询重建到 Cognos Report Studio 10.2 中。

In my SQL-Query I have implemented two prompts.在我的 SQL-Query 中,我实现了两个提示。 The first one:第一个:

SQL: where :date between DATE1 and DATE2 SQL: where :date between DATE1 and DATE2

I can solve this with following function in Cognos:我可以在 Cognos 中使用以下功能解决这个问题:

COGNOS :科诺斯

where TO_DATE (#sq(prompt ( 'date_prompt', 'date' ))#, 'YYYY-MM-DD') between DATE1 and DATE2

but now I have problems with the following prompt where i have to convert der date into char and afterwards into number:但是现在我遇到了以下提示的问题,我必须将 der 日期转换为字符,然后再转换为数字:

SQL:查询语句:

where PART in (299912, to_number(to_char(:date, 'YYYYMM')))

I have tried following function:我尝试了以下功能:

COGNOS:科诺斯:

where PART in (299912, to_number(to_char(TO_DATE (#sq(prompt ( 'date_prompt', 'date' ))#, 'YYYYMM'))))

But i got following Error:但我收到以下错误:

UDA-SQL-0107 General exception error during the operation "open result". UDA-SQL-0107 操作“打开结果”期间的一般异常错误。
ORA-01843 No valid month ORA-01843 无效月份

Since you are using a macro already, just make it do the work.由于您已经在使用宏,只需让它完成工作即可。

#
timestampmask(prompt('StartDate','timestamp'),'YYYYMM')
#

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM