1

If I have a logical task that has a single return value, is there any rule or guideline whether a FUNCTION or PROCEDURE should be used in MySQL? Are there specific use-cases where a FUNCTION is better than a PROCEDURE or vice versa?

I saw a related thread ( Stored procedures and functions ) but that is focused on SQL Server and I imagine this is quite an implementation-specific question; what is the answer for MySQL?

Community
  • 1
  • 1
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589

2 Answers2

1

Functions/procedures return values, functions can be called inside another statement, procedures are statements, and cannot be called in another statement.

damiankolasa
  • 1,508
  • 9
  • 8
1

As John stated, my comment was already the answer.

Just read: MySQL stored procedure vs function, which would I use when?

Community
  • 1
  • 1
eisberg
  • 3,731
  • 2
  • 27
  • 38