In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about the example analysis of Mysql getting the largest of the same substrings of the two strings. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
Length: returns the number of bytes occupied by the string, which is the length of the calculated field. Under utf8 coding, a Chinese character is counted as three characters, and a number or letter is counted as a character. Under other codes, a Chinese character is counted as two characters, and a number or letter as a character.
Char_length: returns the number of characters occupied by a string, regardless of Chinese characters or numbers or letters.
DELIMITER $$
CREATE DEFINER= `testuser` @ `% `getMaxSubStrP` (`inParam1` varchar, `inParam2` varchar, out `resultStr` VARCHAR, out `resultLen`)
BEGIN
DECLARE longStr VARCHAR (255)
DECLARE shortStr VARCHAR (255)
DECLARE tempStr VARCHAR (255)
DECLARE tempResult VARCHAR (255) DEFAULT ""
DECLARE strLength2 INT DEFAULT 0
DECLARE strLength3 INT DEFAULT 0
DECLARE minStrLength INT DEFAULT 0
DECLARE startIndex INT DEFAULT 0
DECLARE endIndex INT DEFAULT 1
DECLARE cmpInt INT DEFAULT 0
SELECT CHAR_LENGTH (inParam1), CHAR_LENGTH (inParam2) INTO strLength2,strLength3 FROM DUAL
SET minStrLength = strLength2
IF minStrLength > strLength3 THEN
SET minStrLength=strLength3
SET longStr = inParam1
SET shortStr = inParam2
ELSE
SET longStr=inParam2
SET shortStr=inParam1
End if
-- select minStrLength,longStr,shortStr
WHILE startIndex < minStrLength
DO
SET endIndex = startIndex + 1
WHILE endIndex0) AND (CHAR_LENGTH (tempResult)
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.