我目前正在研究 MySQL 存储过程,我对这些还很陌生。
我们什么时候需要使用OUT
参数?单独使用 IN
然后在底部只有 SELECT
语句,结果也将返回而无需调用 @OUT
参数。
我只是需要一些光。谢谢。
最佳答案
看看这个article :
IN – is the default mode. When you define an IN parameter in a stored procedure, the calling program has to pass an argument to the stored procedure. In addition, the value of an IN parameter is protected. It means that even the value of the IN parameter is changed inside the stored procedure, its original value is retained after the stored procedure ends. In other words, the stored procedure only works on the copy of the IN parameter.
OUT – the value of an OUT parameter can be changed inside the stored procedure and its new value is passed back to the calling program. Notice that the stored procedure cannot access the initial value of the OUT parameter when it starts.
关于MySQL 存储过程参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34812622/