Summing in Oracle

I have a form that is an invoice with lines some of which are taxable and some are nontaxable.  I
need to sum the lines and display the total of taxable lines and nontaxable lines.  Is there some way
to do this before committing the form to the database and then doing a query.  I would like this
to display on the screen for the user.
jeancwiAsked:
Who is Participating?
 
GoracleConnect With a Mentor Commented:
YOu can place  a formula item (may be hidden) but an a new column with your equation that
do calcs for taxable for the suitable lines
you may use user defined function to decide wether this line should have a tax or not and use it in the formula item

col1          col2           col3       ......      formula item
---------- ------------- --------- --------- ----------------
                                                              .                                                                   .
                                                              .
                                                           summary item

and then you add a summary item that sum the formula item
 
Just ask if you miss any thing

Good luck

Thanx
0
 
neteducationCommented:
oracle forms ?
0
 
jeancwiAuthor Commented:
Yes - Oracle forms.
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
jeancwiAuthor Commented:
Oracle forms 9.02
0
 
sujit_kumarCommented:
For this add one more field (invisible and non-db item) to your block. Say SAL_OLD(NUMBER TYPE). Now write this code in PRE-TEXT-ITEM

      :emp.old_sal := :emp.sal;

Also add WHEN-VALIDATE-ITEM and do this coding in this,

            if nvl(:emp.old_sal,0) <> nvl(:emp.sal,0) then
                  :ctrl.sum_sal := nvl(      :ctrl.sum_sal,0)
                        + nvl(:emp.sal,0)
                        - nvl(:emp.old_sal,0);
            end if;



Now you can see the changed (or values) of Salary field is added in the SUM_SAL filed in the control block.

Sujit
0
 
jeancwiAuthor Commented:
Thanks - I didn't try to first approach as the second one seemed easier.

Thanks for both of you for the help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.