Home » SQL & PL/SQL » SQL & PL/SQL » Pls help me
Pls help me [message #426539] Fri, 16 October 2009 07:19 Go to next message
ramr_Sw
Messages: 31
Registered: October 2009
Member
I have the values 0.19,0.14,0.26 and 0.36
Sum of these values are 0.95

I should normalise these sum of values to 1.00

and round off statement ll do the rounding off 0.95 to 1.

Pls help me
I want to know i also normalise these (0.19,0.14,0.26,0.36) values so that I can get the sum of these values equal to ONE and the normalised values should be updated in the columns of other tables.

Thanks in advance
ramr_sw



Re: Pls help me [message #426544 is a reply to message #426539] Fri, 16 October 2009 07:28 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
update <table>
set <column> = <function to normalize>(<column>)

With the info provided (what "normalization" are you talking about?) I cannot provide you with more detailed help.
Re: Pls help me [message #426546 is a reply to message #426539] Fri, 16 October 2009 07:43 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> with data as (
  2  select 0.19 val from dual
  3  union all 
  4  select 0.14 from dual
  5  union all
  6  select 0.26 from dual
  7  union all 
  8  select 0.36 from dual
  9  )
 10  select val, 
 11         ratio_to_report(val) over () new_val1,
 12         val / sum(val) over () new_val2
 13  from data
 14  /
       VAL   NEW_VAL1   NEW_VAL2
---------- ---------- ----------
       .19         .2         .2
       .14 .147368421 .147368421
       .26 .273684211 .273684211
       .36 .378947368 .378947368

Regards
Michel
Re: Pls help me [message #426549 is a reply to message #426546] Fri, 16 October 2009 08:04 Go to previous messageGo to next message
ramr_Sw
Messages: 31
Registered: October 2009
Member
Hi Michael

I am getting Toad Error when i copying and running from toad..

SQL does not return rows

is that ratio_to_report in built oracle function?

Thanks in advance
ramr_Sw
Re: Pls help me [message #426550 is a reply to message #426549] Fri, 16 October 2009 08:06 Go to previous messageGo to next message
cookiemonster
Messages: 12415
Registered: September 2008
Location: Rainy Manchester
Senior Member
ramr_Sw wrote on Fri, 16 October 2009 14:04
Hi Michael

I am getting Toad Error when i copying and running from toad..

SQL does not return rows

is that ratio_to_report in built oracle function?

Thanks in advance
ramr_Sw


What happens if you run it in sqlplus?
Re: Pls help me [message #426552 is a reply to message #426550] Fri, 16 October 2009 08:13 Go to previous messageGo to next message
ramr_Sw
Messages: 31
Registered: October 2009
Member
I am getting the following error when copy n runnin the code

"SQL statement does not return rows"

Thanks in advance
Ramr_Sw
Re: Pls help me [message #426553 is a reply to message #426539] Fri, 16 October 2009 08:26 Go to previous messageGo to next message
cookiemonster
Messages: 12415
Registered: September 2008
Location: Rainy Manchester
Senior Member
You aren't getting that message from sqlplus.
Again
What happens if you run it in sqlplus?
Re: Pls help me [message #426555 is a reply to message #426549] Fri, 16 October 2009 08:28 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
is that ratio_to_report in built oracle function?

Yes, since version 8.1.6

Regards
Michel
Re: Pls help me [message #426556 is a reply to message #426553] Fri, 16 October 2009 08:36 Go to previous messageGo to next message
ramr_Sw
Messages: 31
Registered: October 2009
Member
i ran it from toad...and getting this msg..

thanks in advance
ramr_Sw
Re: Pls help me [message #426557 is a reply to message #426556] Fri, 16 October 2009 08:40 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So maybe a TOAD error.
Use SQL*Plus.

Regards
Michel
Re: Pls help me [message #426558 is a reply to message #426556] Fri, 16 October 2009 08:41 Go to previous message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide.
Also always post your Oracle version with 4 decimals.

Regards
Michel
Previous Topic: How to take export and import in a procedure
Next Topic: nested materialized views
Goto Forum:
  


Current Time: Thu Dec 08 01:53:04 CST 2016

Total time taken to generate the page: 0.04946 seconds