MySQL 存储过程参数

标签 mysql stored-procedures parameters inout

我目前正在研究 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/

相关文章:

mysql - 检查MySQL如果行不存在,则插入(没有唯一键)

oracle - 在 Oracle 存储过程中访问另一个用户的表

ruby-on-rails - 使用带有参数和 form_tag 的命名路由

java - 将支持 bean 实例作为参数传递给另一个支持 bean 方法

parameters - 从命令行启动时无法覆盖 Talend 作业上下文参数

mysql - 无法读取 odbc 函数 - Asterisk

php - PHP 中的 session (用户登录)

java - 通过 Java 类声明 OUT 参数

php - 如何处理服务器和客户端之间的时区?

c# - SqlDataReader 从 SQL Server 2008 读取位数据类型?