In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "the nesting use of MySQL cursors". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "the nesting use of MySQL cursors"!
A few days ago, someone in the group asked if MySQL cursors could be nested and took it for granted. Later, they tried it and found that it could, alas, not just take it for granted. Examples are as follows:
CREATE PROCEDURE curdemo ()
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT'
BEGIN
Declare done1,done2 int default 0
Declare name1,name2 varchar (20)
Declare id1,id2 int
Declare cur1 cursor for select id,name from test1
Declare continue handler for not found set done1 = 1
Open cur1
Repeat
Fetch cur1 into id1, name1
If not done1 then
Insert into test3 (name) values (name1)
Begin
Declare cur2 cursor for select id,name from test2
Declare continue handler for not found set done2 = 1
Open cur2
Repeat
Fetch cur2 into id2,name2
If not done2 then
Insert into test3 (name) values (name2)
End if
Until done2 end repeat
Close cur2
Set done2=0
End
End if
Until done1 end repeat
Close cur1
Commit
END
At this point, I believe you have a deeper understanding of the "nesting use of MySQL cursors". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.