This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Geeta, The easiest way is to do it in Java after the JDBC result is returned. If you need to do this in standalone SQL, the answer is database specific - if possible at all. What database are you using if you can't use JDBC.