In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces what MySQL stored procedures need to pay attention to by using if sub-query, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let the editor take you to know it.
MySQL stored procedure
Environment 5.6.14
Drop procedure if exists p
DELIMITER $$
CREATE PROCEDURE `p` ()
BEGIN
Start transaction
If (select 10 from dual where 1: 1 < 5) then
Select 'true'
Else
Select 'false'
End if
Commit
END $$
DELIMITER
Call p
Sometimes to save trouble, a subquery is used in if to return a value and then make a comparison.
Just like the above test process.
But when it is actually executed, the procedure returns true. Basically ignored the results of select, all entered the branch of true.
I think MySQL takes the judgment behind where as the content of comparison, and the above process seems to compare if ((1) 1).
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.