Home » SQL & PL/SQL » SQL & PL/SQL » Using nvl within a sum (Oracle Sql Developer 1.1.3)
Using nvl within a sum [message #570960] Mon, 19 November 2012 05:49 Go to next message
SteveShephard
Messages: 32
Registered: August 2012
Member
Hi guys,

I have a very simple sum within a select statement

select (PERCENTAGE*10) from MYTABLE


I was hoping to add a NVL to this but seem to be running into problems (below - invalid number of arguments)

select nvl(PERCENTAGE*10 'X')from IC_SS_PRICE_CHANGE_IMPORT_TAB


Is something like this possible?

Many thanks guys

Steve
Re: Using nvl within a sum [message #570965 is a reply to message #570960] Mon, 19 November 2012 06:10 Go to previous messageGo to next message
cookiemonster
Messages: 10853
Registered: September 2008
Location: Rainy Manchester
Senior Member
You're missing a comma.
Re: Using nvl within a sum [message #570966 is a reply to message #570960] Mon, 19 November 2012 06:11 Go to previous messageGo to next message
Michel Cadot
Messages: 58625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
but seem to be running into problems


Sure, you have a syntax error, a comma is missing.
If you use SQL*Plus, it will tell you where it is missing.
And note that the 2 arguments of NVL should be of the same datatype (how do you sum 10 and X?).
And note that the aggregate functions ignore NULLs.

Regards
Michel

[Updated on: Mon, 19 November 2012 06:17]

Report message to a moderator

Re: Using nvl within a sum [message #570968 is a reply to message #570966] Mon, 19 November 2012 06:15 Go to previous message
SteveShephard
Messages: 32
Registered: August 2012
Member
Cheers guys - new it was something simple! thanks a lot!
Previous Topic: Range
Next Topic: Error while deleting partition of a table
Goto Forum:
  


Current Time: Wed Jul 30 18:53:41 CDT 2014

Total time taken to generate the page: 0.71992 seconds