Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sum a column in text field without last record

Status
Not open for further replies.

hudo

Programmer
Dec 4, 2003
94
DE
Hello,
in a form is the table scott.emp displayed with an additional column lfdnr
with the entries 0,1,2,...,13 (with the scott.emp having 14 records)

How can the sum of the column emp.sal be displayed in another text item
but the value of emp.sal of the last record should not be included in the summmation

SELECT SUM(EMP.SAL)
WHERE LFDNR <> MAX(LFDNR)

Sincerely
 
use a while loop. Something like this should be work. just use a go_item to wherever u need the cursor to go afterwards.
declare
v_sum number();
last_record boolean;
begin
first_record;
while last_record = TRUE loop
if :system.last_record = TRUE then
last_record := FALSE;
else
v_sum := v_sum + :emp.sal;
end if;
end loop;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top