Bug #57553 There is no built in funtion INITCAP() in MySql

Submitted: 19 Oct 2010 7:46 Modified: 19 Oct 2010 12:42
Reporter: Mayur Rana Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:5.0.77-log OS:Any
Assigned to: CPU Architecture:Any
Tags: INITCAP

[19 Oct 2010 7:46] Mayur Rana
Description:
I want to give you one feedback
regarding MySql built in function.

As per I had search on net and as per my knowledge there is no any
inbuilt Function in MYSQL like INITCAP() , which is available in Oracle.
(Is there any built in function in MySql for the same ??)

I had created one function in MYSQL using other built in functions,
which will return same output as Oracle INITCAP() function will return.

As below :

CREATE FUNCTION MY_INITCAP (T_NAME VARCHAR(200)) RETURNS varchar(200)
CHARSET latin1
BEGIN
     DECLARE MY_NAME VARCHAR(50) DEFAULT 'Created By MAYUR RANA';
     DECLARE V_NAME VARCHAR(200);
     DECLARE R_NAME VARCHAR(200) DEFAULT '';   
   
     SET V_NAME = TRIM(T_NAME);
     
     WHILE (INSTR(V_NAME,' ') > 0)
     DO
        SET R_NAME = CONCAT(R_NAME,'
',UCASE(LEFT(V_NAME,1)),SUBSTRING_INDEX(LOWER(SUBSTRING(V_NAME,2)),'
',1));   
   
        SET V_NAME = LTRIM(SUBSTRING(V_NAME,INSTR(V_NAME,' ')));
     END WHILE;

        SET R_NAME = CONCAT(R_NAME,'
',UCASE(LEFT(V_NAME,1)),SUBSTRING_INDEX(LOWER(SUBSTRING(V_NAME,2)),'
',1));   

     RETURN LTRIM(R_NAME);
END

How to repeat:
I want to display Name columns in report , having initial letter in capital. There is INITCAP() function in Oracle but not in MySql. If is there any built in function in mysql for the same, than I am very very sorry for this bug report.
[19 Oct 2010 12:42] Valeriy Kravchuk
Duplicate of Bug #2340.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.