Home » Developer & Programmer » Forms » running sum in form 6i (form 6i, oracle 10g)
running sum in form 6i [message #689912] Sat, 27 July 2024 02:57 Go to next message
shahzad-ul-hasan
Messages: 628
Registered: August 2002
Senior Member
i want to use running sum in form 6i.please advise me.
Table
dsno   number(5)
pname  varchar2(80)
tdate  date
bamt   number(7)
ramt   number(7)
Bal    number(12)

Date
dsno pname       tdate         Bamt     Ramt    bal  
1    Guchi      12-Jul-2024    12600    0       12600
2    Guchi      15-Jul-2024    11600    15000   9200
3    Guchi      17-Jul-2024    1600     0       10800
4    Guchi      18-Jul-2024    5600     0       16400
5    Guchi      19-Jul-2024    12600    3000    13400 

[Updated on: Sat, 27 July 2024 02:58]

Report message to a moderator

Re: running sum in form 6i [message #689915 is a reply to message #689912] Sat, 27 July 2024 05:35 Go to previous messageGo to next message
Michel Cadot
Messages: 68712
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Have a look at SUM in its analytic form.
The example in this page is exactly what you need.

[Updated on: Sat, 27 July 2024 05:36]

Report message to a moderator

Re: running sum in form 6i [message #689916 is a reply to message #689915] Sat, 27 July 2024 06:27 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 628
Registered: August 2002
Senior Member
i have used this in Post-Query trigger:
declare
	a number;
begin
	SELECT nvl(sum(bamt),0)-nvl(sum(ramt),0) OVER (PARTITION BY tdate ORDER BY dsno
   RANGE UNBOUNDED PRECEDING) into :n
   FROM dsale_det
   where pname=:pname;
exception when no_data_found then
	:n:=0;
end;

error: encountered symbol when expecting one of the following
   .from into
Re: running sum in form 6i [message #689921 is a reply to message #689916] Mon, 29 July 2024 05:25 Go to previous message
cookiemonster
Messages: 13952
Registered: September 2008
Location: Rainy Manchester
Senior Member
I doubt that forms 6i recognizes analytic sum and even if it did you couldn't use it in post-query like that.
You would need to create a view with the sum analytic in it and base the datablock on that.
Previous Topic: Oracle Function Median
Next Topic: Need to Implement Form Folder Functionality in the Oracle R12 Custom Form
Goto Forum:
  


Current Time: Wed Nov 13 02:45:35 CST 2024