Home > Database > Mysql Tutorial > The function of the call statement is

The function of the call statement is

(*-*)浩
Release: 2019-07-27 11:36:49
Original
5492 people have browsed it

The CALL statement can return a value to its caller using parameters declared as OUT or INOUT parameters.

The function of the call statement is

It also "returns" the number of affected rows, the client program can obtain this at the SQL level by calling the ROW_COUNT() function Number, obtained from C by calling the mysql_affected_rows() C API function. (Recommended learning: MySQL video tutorial)

Grammar notes:

1,MySQL 存储过程中的每条语句的末尾,都要加上分号 “;”
  ...
  declare c int;
  if a is null then
     set a = 0;
  end if;
  ...
end;
2,注释是  --   ;  MySQL 存储过程的参数不能指定默认值
3,不能在 MySQL 存储过程中使用 “return” 关键字。
  set c = a + b;
  select c as sum;
 
end;
4. 调用 MySQL 存储过程时候,需要在过程名字后面加“()”,即使没有一个参数,也需要“()”
call pr_no_param();
5. 因为 MySQL 存储过程参数没有默认值,所以在调用 MySQL 存储过程时候,不能省略参数。可以用 null 来替代。
call pr_add(10, null);
Copy after login

For more MySQL related technical articles, please visit MySQL tutorial column to learn!

The above is the detailed content of The function of the call statement is. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template