In Oracle, INITCAP()
function converts the first letter of each word to uppercase. Below are the syntax and examples of Oracle INITCAP()
function:
Oracle INITCAP() Syntax
initcap(string)
Oracle INITCAP() Function Examples:
Example-1:
Get the employee name from the EMP table with the first letter in uppercase:
select initcap(ename) ename from emp;
Output:
King
Blake
Clark
Jones
Scott
Ford
Smith
Allen
Ward
Martin
Example-2:
Oracle SQL Query to get the single string value using the INITCAP() function:
select initcap('oracle forum') from dual;
Output:
Oracle Forum
Example-3:
Using INITCAP()
function in PL/SQL code:
declare v_string varchar2(100); begin v_string := initcap('orclqa.com'); dbms_output.put_line(v_string); end;
Output:
Orclqa.com
In this tutorial, you have learned how to make the first letter of a string to uppercase in Oracle using the INITCAP()
function. You can also check the following PL/SQL amount to words example to convert any numeric value to words in Indian Rupee format.
Leave a comment