Home » Developer & Programmer » Reports & Discoverer » TO_NUM and error handling
TO_NUM and error handling [message #281121] Thu, 15 November 2007 16:06 Go to next message
jfrano
Messages: 11
Registered: January 2007
Location: New York
Junior Member
Is there a way to use the TO_NUM function in a Discoverer Report such that it will not fail with "Invalid Number" error.

Thanks
Re: TO_NUM and error handling [message #281122 is a reply to message #281121] Thu, 15 November 2007 16:08 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Facetious answer first:
Pass only valid numbers Surprised
Next, what do you want it to do if it comes across an invalid number?
Re: TO_NUM and error handling [message #281125 is a reply to message #281122] Thu, 15 November 2007 16:20 Go to previous messageGo to next message
jfrano
Messages: 11
Registered: January 2007
Location: New York
Junior Member
Just inserting a NULL would be fine.
Re: TO_NUM and error handling [message #281218 is a reply to message #281125] Fri, 16 November 2007 03:02 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
It's early in the morning,and I know that this can be done tidier (using reg expressions) but I require food and coffee, so here is what I can give you:
to_number(nvl2(replace(translate(xyz,'1234567890.','~#-'),'~#-',''),'0',xyz))

where xyz is the name of your item.
Re: TO_NUM and error handling [message #281389 is a reply to message #281121] Fri, 16 November 2007 11:29 Go to previous message
jfrano
Messages: 11
Registered: January 2007
Location: New York
Junior Member
Very nice!

Thanks much
Previous Topic: Create Report LOG On client PC
Next Topic: Error REP - 0501 Couldnot connect to database
Goto Forum:
  


Current Time: Sat Dec 03 12:03:36 CST 2016

Total time taken to generate the page: 0.11628 seconds