SHARE
TWEET

Untitled

a guest Dec 22nd, 2012 14 Never
  1. CREATE FUNCTION INCREMENT()
  2. RETURNS INT
  3. BEGIN
  4. DECLARE newVal;
  5. UPDATE table_x SET currentVal=currentVal+1;
  6. SELECT currentVal INTO newVal FROM table_x;
  7. RETURN newVal;
  8. END;
  9.        
  10. CREATE FUNCTION INCREMENT()
  11. RETURNS INT
  12. BEGIN
  13. DECLARE newVal;
  14. Begin tran
  15. UPDATE table_x SET currentVal=currentVal+1;
  16. SELECT currentVal INTO newVal FROM table_x;
  17. Commit tran
  18. RETURN newVal;
  19. END;
RAW Paste Data
Top