MySQL Forums
Forum List  »  Stored Procedures

Stored Functions and phpMyAdmin
Posted by: Marc Elbet
Date: December 06, 2015 04:45PM

HI, good evening

I am new to this forum and need a bit of help.
I try to use this stored function that seems to be OK but that phpMyAdmin rejects vigorously despite my efforts.
I can't understand where I get it wrong and it drives me nuts.
Any help will be appreciated.
Thank you.

Marc.

CREATE function No_fancy-char ( @String_in varchar(50) )returns varchar(50)

declare @i int = 1
declare @String_in varchar(100) = @String_in Collate utf8mb4_unicode_ci
declare @String_out varchar(100) = ''

SET @String_in = LOWER(@String_in)

SET @String_in = REPLACE(@String_in,' ', '')
SET @String_in = REPLACE(@String_in,'à', 'a')
SET @String_in = REPLACE(@String_in,'â', 'a');
SET @String_in = REPLACE(@String_in,'è', 'e')
SET @String_in = REPLACE(@String_in,'é', 'e')
SET @String_in = REPLACE(@String_in,'ë', 'e')
SET @String_in = REPLACE(@String_in,'ì', 'i')
SET @String_in = REPLACE(@String_in,'î', 'i')
SET @String_in = REPLACE(@String_in,'ï', 'i')
SET @String_in = REPLACE(@String_in,'ò', 'o')
SET @String_in = REPLACE(@String_in,'ù', 'u')
SET @String_in = REPLACE(@String_in,'û', 'u')
SET @String_in = REPLACE(@String_in,'ç', 'c')
SET @String_in = REPLACE(@String_in,'$', '')
SET @String_in = REPLACE(@String_in,'£', '')
SET @String_in = REPLACE(@String_in,'€', '')
SET @String_in = REPLACE(@String_in,'''', '')
SET @String_in = REPLACE(@String_in,'"', '')
SET @String_in = REPLACE(@String_in,':', '')
SET @String_in = REPLACE(@String_in,'`', '')
SET @String_in = REPLACE(@String_in,'-', '')
SET @String_in = REPLACE(@String_in,'+', '')
SET @String_in = REPLACE(@String_in,'(', '')
SET @String_in = REPLACE(@String_in,')', '')
SET @String_in = REPLACE(@String_in,'?', '')
SET @String_in = REPLACE(@String_in,'!', '')
SET @String_in = REPLACE(@String_in,'#', '')

while @i <= Len(@String_in)
begin
if SubString(@String_in, @i, 1) like '[a-Z]'
begin
set @String_out = @String_out + SubString(@String_in, @i, 1)
end
set @i = @i + 1
end

return @String_out

end

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored Functions and phpMyAdmin
2620
December 06, 2015 04:45PM
865
December 06, 2015 07:27PM
723
December 10, 2015 08:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.