How can i store the value returned by sql statement in a variable.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • svpriyan
    New Member
    • Apr 2009
    • 18

    How can i store the value returned by sql statement in a variable.

    Hai,
    I have two columns called income and tax in DB2 database . now i wanted to retrieve both two columns using java and do subtraction and store them in a column called net pay.
    i got some hint like ,first i have to retrieve 2 columns records and store them in variables and then do calculation. is this way i have to do.
    any hints please
    priya
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    try direct subtraction, something like

    select income, tax,(income - tax ) as netpay from salary

    Comment

    Working...