In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
A set of SQL statements with high speed. Only the first execution needs to go through compilation and optimization steps, and the subsequent calls can be executed directly.
Sample:
DROP PROCEDURE IF EXISTS `proc_ adder`
DELIMITER & &
CREATE DEFINER= `root` @ `localhost` PROCEDURE `proc_ adder` (IN an int, IN b int, OUT sum int)
BEGIN
DECLARE c int
/ * DECLARE c int DEFAULT 10 minutes /
If an is null then set a = 0
End if
If b is null then set b = 0
End if
Set sum = a + b
END
& &
DELIMITER
Description:
DEFINER: creator
DECLARE: defining variabl
SET: assign to a variable
SELECT... The INTO statement assigns values to variables as follows:
SELECT col_name [,...] INTO var_name [,...]
FROM table_name WEHRE condition
DELIMITER:
The default statement Terminator in MySQL is the semicolon (;). The SQL statement in the stored procedure requires a semicolon (;) to end. To avoid conflicts, first set the MySQL Terminator to & & with "DELIMITER & &". Finally, use "DELIMITER;" to restore the Terminator to a semicolon. This is the same as when you create a trigger.
Common syntax:
IF:
IF type = 0 THEN
Set c = 'param is 0'
ELSEIF type = 1 THEN
Set c = 'param is 1'
ELSE
Set c = 'param is others, not 0 or 1'
END IF
CASE:
CASE type
WHEN 0 THEN
Set c = 'param is 0'
WHEN 1 THEN
Set c = 'param is 1'
ELSE
Set c = 'param is others, not 0 or 1'
END CASE
WHILE:
DECLARE i int
DECLARE s int
SET I = 0
SET s = 0
WHILE i
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.