Supriya,
I would not recommend embedding SQL in your XSJS file as Florian's example. that is just bad practice. instead you should call a stored procedure from your xsjs file
here is an example of calling a stored procedure and reading an output parameter from the same call
hope this helps