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.