Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Newbie
 
Join Date: Apr 2009
Posts: 18
#1: Jul 29 '09
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's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,509
#2: Jul 29 '09

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


try direct subtraction, something like

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