简体   繁体   中英

COGNOS: Convert SQL date prompt to date prompt in Cognos

I currently have a problem to convert an SQL date prompt in Cognos. I would like to rebuild a SQL-Query into Cognos Report Studio 10.2.

In my SQL-Query I have implemented two prompts. The first one:

SQL: where :date between DATE1 and DATE2

I can solve this with following function in 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:

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".
ORA-01843 No valid month

Since you are using a macro already, just make it do the work.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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