clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 648593 fiddles created (15317 in the last week).

CREATE FUNCTION GetStringCount1(strValue VARCHAR(200), charValue VARCHAR(200)) RETURNS INTEGER DETERMINISTIC NO SQL BEGIN RETURN FLOOR((LENGTH(strValue) - LENGTH(REPLACE(strValue, charValue, ''))) / LENGTH(charValue)); END
 hidden batch(es)


CREATE FUNCTION GetStringCount2(strValue VARCHAR(200), charValue VARCHAR(200)) RETURNS INTEGER DETERMINISTIC NO SQL BEGIN RETURN (CHAR_LENGTH(strValue) - CHAR_LENGTH(REPLACE(strValue, charValue, ''))) / CHAR_LENGTH(charValue); END
 hidden batch(es)


SELECT GetStringCount1('Hello World', 'l'); -- 3
GetStringCount1('Hello World', 'l')
3
 hidden batch(es)


SELECT GetStringCount2('Test Test', 'es'); -- 2
GetStringCount2('Test Test', 'es')
2
 hidden batch(es)


SELECT GetStringCount1('Hello World', 'l'); -- 3
GetStringCount1('Hello World', 'l')
3
 hidden batch(es)


SELECT GetStringCount2('Test Test', 'es'); -- 2
GetStringCount2('Test Test', 'es')
2
 hidden batch(es)