in T-SQL(sql server)
you can declare a va riable (@var) and use it in query to copy the value.
select @total= sum(''salary) from table_name
in oracle:
if it is single query used in application one can use direct as Monissha wrote above,
if it comes to procedure you can copy the values from select query list into varibles like this:
procedure()
begin
var
select sum(coulumn1) into var from table_name;
end