I tried to run this prompt in infoview and I got and error: A database error occured. The database error text is: ORA-01830: date format picture ends before converting entire input string
. (WIS 10901)
The code is validated successfully but when running the report only this error comes.
This is the code of the prompt:-
trunc(Table.Date_field) in (Case when to_date(@Prompt('Date','D',,mono,free),'dd/mm/yyyy') = '01/01/1900' then to_date(sysdate,'dd/mm/yyyy') else to_date(@Prompt('Date','D',,mono,free),'dd/mm/yyyy') end )
I tried trunc so as to strip the time stamp part. My database is Oracle.
Can I ask why you are trying to turn sysdate into a date? It’s already a date and needs no conversion.
You may want to present the format in the prompt so the end users know what to enter, or you might be able to use a format mask in the to_date conversion to handle some of the single number values (like day or month):
trunc(Table.Date_field) in (Case when to_char(@Prompt('Date','D',,mono,free),'dd/mm/yyyy') = '01/01/1900' then to_char(sysdate,'dd/mm/yyyy') else to_char(@Prompt('Date','D',,mono,free),'dd/mm/yyyy') end )
But now I m getting this error while running the report.
A database error occured. The database error text is: ORA-01722: invalid number
. (WIS 10901)
I have just tried the following and it works as expected. Amend for your needs and try it:
trunc(Date Field) = (case when to_date(@prompt(‘Date’,‘D’,mono,free)) = ‘01/01/1900’ then trunc(sysdate) else to_date(@prompt(‘Date’,‘D’,mono,free)) end)
I was talking only about the green part and not the red part, because @prompt returns a string and so to_date() should be used. Anyways, it is good it is now resolved.
Please do not use Instant Message abbreviations on BOB. We want to keep BOB easy to understand for our International community. Thanks.