Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. CREATE PROCEDURE (IN...)
  2. BEGIN
  3. DECLARE ret_code
  4. ...UPDATE SOMETHING....
  5. SELECT ret_code as return_code from dual;
  6. END
  7.  
  8. CREATE PROCEDURE (IN...)
  9. BEGIN
  10. DECLARE returnVal
  11. if(conditional true)
  12. ..Update something else..
  13. Set returnVal = x;
  14. else
  15. call proc1(var1,...)
  16. Set returnVal = (ret_code obtained from proc1)
  17. end if
  18. select returnVal;
  19. END
  20.  
  21. CREATE FUNCTION (...) RETURNS ...datatype...
  22. BEGIN
  23. DECLARE ret_code
  24. ...UPDATE SOMETHING....
  25. RETURN ret_code;
  26. END
  27.  
  28. CREATE FUNCTION (...) RETURNS ...datatype...
  29. BEGIN
  30. DECLARE returnVal
  31. if(conditional true)
  32. ..Update something else..
  33. Set returnVal = x;
  34. else
  35. Set returnVal = proc1(var1,...)
  36. end if
  37. RETURN returnVal;
  38. END
  39.  
  40. CREATE PROCEDURE (OUT ret_code ...datatype..., IN...)
  41. BEGIN
  42. ...UPDATE SOMETHING....
  43. Set ret_code = return_code;
  44. END
  45.  
  46. CREATE PROCEDURE (OUT returnVal ...datatype..., IN...)
  47. BEGIN
  48. if(conditional true)
  49. ..Update something else..
  50. SET returnVal = x;
  51. else
  52. call proc1(returnVal, var1,...)
  53. end if
  54. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement