Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sum of N Numbers in PL/SQL

758839Mar 9 2010 — edited Jul 24 2011
Hi,

I need to get the Sum of N different numbers using PL/ SQL.
I have written the code like this

Declare
Sum Number := 0;
Begin

For I in 1 .. 5
Loop
Sum := Sum + &Num;
End Loop;

Dbms_Output.Put_Line('Sum = ' || Sum);
End;
/

But once only its accepting the value for Num.

Can I get any solution for this?

With Regards,
Prakash D

Edited by: user12773448 on Mar 9, 2010 3:12 AM

Edited by: Prakash D on Mar 9, 2010 3:13 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 21 2011
Added on Mar 9 2010
6 comments
30,181 views