$ 0 0 Hi Mayur, I have found the way to get the Surplus Output in SQL itself just now.So no need write the Procedure and Cursor logic. Please use this logic for you data and check whether it is giving correct results?