Home » SQL & PL/SQL » SQL & PL/SQL » Script error help
Script error help [message #210288] Wed, 20 December 2006 03:12 Go to next message
Anto318
Messages: 27
Registered: December 2006
Junior Member
Hi all,

I am writing a script to round a figure to two significant figures and have come up with this.

SELECT Case WHEN 0.0215 > 0 Then round(0.0215,1-floor(LOG10(0.0215))) Else round(0.0215,1-floor(LOG10(-0.0215))) End FROM dual;

I am getting an error ora-00904 "LOG10" invalid identifier

Why is this happening and does anybody know how to fix it?

I hope you can help.

Best Wishes.
AM
Re: Script error help [message #210297 is a reply to message #210288] Wed, 20 December 2006 03:47 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
The syntax for Log is LOG(m,n) where m is the base you're taking logs to and n is the number whos Log you are calculating.

You want to use LOG(10,n) rather than LOG10(n)

You can replace this CASE statement with
round(ABS(value),1-floor(LOG(10,value)))
Re: Script error help [message #210303 is a reply to message #210297] Wed, 20 December 2006 04:04 Go to previous message
Anto318
Messages: 27
Registered: December 2006
Junior Member
Thank you very much works perfectly
Previous Topic: tree view query
Next Topic: DBMS_SCHEDULER
Goto Forum:
  


Current Time: Sat Dec 03 06:13:50 CST 2016

Total time taken to generate the page: 0.10392 seconds