Home > Database > Mysql Tutorial > mysql ROW_COUNT 在存储过程中的使用实例

mysql ROW_COUNT 在存储过程中的使用实例

WBOY
Release: 2016-06-01 09:56:57
Original
1733 people have browsed it

在Mysql中ROW_COUNT()返回前一个SQL进行UPDATE,DELETE,INSERT操作所影响的行数。

注意在UPDATE中,如果替换前、后值是一样的,ROW_COUNT也会返回0。

存储过程示例示例:

<code class="language-sql">begin 
insert into test values('','第一条');
if ROW_COUNT()>0 then
insert into test values('','第二条');
end if;
end</code>
Copy after login

如果第一条数据插入成功,再插入第二条数据。

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