List:General Discussion« Previous MessageNext Message »
From:Sebastian Mendel Date:June 12 2008 11:26am
Subject:Re: Function Still Not Working
View as plain text  
Jesse schrieb:
> Sorry for posting this again, but I got only one response last time, and 
> I'm still having the problem.  I spent HOURS the other day manually 
> going through the data and Properizing these things by hand. I don't 
> want to do that again if I can avoid it.  If anyone has any clues on 
> this one, I would appreciate it.
> 
> The only difference in this and what I have now is that someone 
> suggested changing it to Deterministic, which I did, and that didn't 
> change the output.  I also changed "SQL SECURITY DEFINER" to "SQL 
> SECURITY INVOKER", and that didn't make a difference either.
> ----
> I have the following function on two servers:
> 
> CREATE FUNCTION `ProperCase`(cInput TEXT)
>   RETURNS text
>   NOT DETERMINISTIC
>   CONTAINS SQL
>   SQL SECURITY DEFINER
>   COMMENT ''
> BEGIN
>   Declare cReturn Text;
>   Set cReturn = CONCAT(UPPER(SUBSTRING(cInput,1,1)),LOWER(SUBSTRING(cInput
> FROM 2)));
>   RETURN cReturn;
> END;
> 
> It's a very simple function used to properize a string sent to it. When 
> I do
> a simple SELECT ProperCase('JESSE'); it returns "JESSE" on our server that
> is running 5.0.17-nt-log. On another server that I've got, running
> 5.0.51a-community-nt, this function returns "Jesse" as it should.

does it work outside the function?

did you tried SUBSTRING(cInput, 2)?

did you tried with converting?

from the manual: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html

"LOWER() (and UPPER()) are ineffective when applied to binary strings 
(BINARY, VARBINARY, BLOB). To perform lettercase conversion, convert the 
string to a non-binary string:

mysql> SET @str = BINARY 'New York';
mysql> SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));"

-- 
Sebastian Mendel
Thread
Function Still Not WorkingJesse12 Jun
  • Re: Function Still Not WorkingMartijn Tonies12 Jun
    • RE: Function Still Not WorkingTodd M. Boyd12 Jun
  • Re: Function Still Not WorkingSebastian Mendel12 Jun
  • Re: Function Still Not WorkingJesse12 Jun
  • Re: Function Still Not WorkingJesse12 Jun
    • RE: Function Still Not WorkingTodd M. Boyd13 Jun
  • Re: Function Still Not WorkingJesse13 Jun
  • Re: Function Still Not WorkingJesse15 Jun