Discoverer Newbie question on TO_DATE [message #144703] |
Thu, 27 October 2005 14:02 |
sbattisti
Messages: 39 Registered: June 2005
|
Member |
|
|
I'm a Discoverer 4i newbie, trying to create a relatively simple Discoverer report, but I'm pulling Adjusted Service Date from a flex field, and it's formatted as varchar2. I'm trying to use a to_date function to convert it to a date, but I can't seem to get the syntax correct.
Can anyone help?
Thanks,
Steve
|
|
|
|
|
Re: Discoverer Newbie question on TO_DATE [message #144806 is a reply to message #144703] |
Fri, 28 October 2005 07:56 |
sbattisti
Messages: 39 Registered: June 2005
|
Member |
|
|
The dates in the varchar2 field are formatted as dd-mmm-yyyy, for example:
25-JUN-1999
When I use the calculation I get ORA01821: date format not recognized.
I've tried a number of different syntaxes, the last of which was this:
TO_DATE(table.field, 'dd-mmm-yyyy')
I've left the nlsparam blank, since it's my understanding that it will just take the default date format based on the NLS_TERRITORY init parameter.
I can't find any detailed examples in the Discoverer documentation.
Any suggestions would be welcomed!
|
|
|
|
|
Re: Discoverer Newbie question on TO_DATE [message #156563 is a reply to message #144703] |
Wed, 25 January 2006 15:38 |
sbattisti
Messages: 39 Registered: June 2005
|
Member |
|
|
As a follow-up to this, I am struggling with another similar situation. I have a field calculated as follows:
TO_DATE(table.field, 'yyyy-mm-dd')
This does an excellent job of returning my text field in date format, as follows:
15-APR-06
Unfortunately, we really need it to return as:
15-APR-2006 (4-character year instead of 2-character)
Changing our global NLS_DATE_FORMAT is not possible, so I've been trying to add the NLS_DATE_FORMAT at the end of the calculation, like this:
TO_DATE(table.field, 'yyyy-mm-dd',NLS_DATE_FORMAT='DD-MMM-YYYY')
I've used various combinations of single and double-quotes, but I can't seem to stop it from erroring out. The documentation I have found seems to indicate this should work.
The error I receive is:
ORA12702: invalid NLS parameter string used in SQL function
Any suggestions?
Thanks!
Steve
|
|
|