Answer the question
In order to leave comments, you need to log in
Procedure or function?
Tell me please! What to use where ,,, their difference, as I understand it, is that the function returns a value and can be directly used in the request, but this is not possible with HP.
Well, actually what where to use? If I'm not going to use the return value and I'm not going to use the function directly in the request, should I use xn instead of the function?
Answer the question
In order to leave comments, you need to log in
Смысла использовать процедуры нет. Функции - возможно при каких-нибудь сложных выборках для отчётов, чтобы не дублировать код (ничтожная вероятность, что вам это понадобится).
Логика в базе обходится очень дорого в разработке и поддержке. Избегайте этого и не используйте.
Quite simply:
A function is when you need to get some result. For example, cleaning a phone number from parasitic characters (brackets, hyphens, etc.)
Procedure - when you need to perform some action. Like an abstract document with strings, various actions with document strings (adding, deleting, changing) and recalculating the document.
MySQL is not the most indicative in this regard, in other variants - functions and procedures are actively used.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question