Hello friends My name is SHRIPAL SINGH and i'm working as a ORACLE DBA from july 2012 to till now. Behind of making this blog my purpose is making that easy to understand of ORACLE DATABASE, so that every body can understand it easily, i also making a YouTube channel www.youtube.com/user/ocptechno , connect to my YouTube channel and enjoy free videos.
Friday, December 31, 2021
Data Pump Export Import Over the Network using network_link
Thursday, December 16, 2021
Wednesday, January 6, 2021
What is Character Functions
Hello, friends in this article we are going to discuss how to use Character Functions in SQL. The character functions accept only Character type values and return in character and number both.
Type of Character Functions
There are eight types of Character Functions in SQL.
- CONCAT
- SUBSTR
- LENGTH
- INSTR
- LPAD
- RPAD
- REPLACE
- TRIM
So, let's understand the working of each function one by one.
1. CONCAT
The CONCAT function joint two or more strings and display as a single string. We can use a minimum of two strings with the CONCAT function. For example, we have two strings like “OCP” and “TECHNOLOGY” and we want to display both strings together.
SQL> SELECT CONCAT('OCP','TECHNOLOGY') FROM DUAL;
The output from the above query is “OCPTECHNOLOGY“.
2. SUBSTR
The SUBSTR function Retrieve a part of the string as specified the length in function, as you can see in the below output. As we have a string like “OCPTECHNOLOGY” and we just want to display only the first three characters of the string.
SQL> SELECT SUBSTR('OCPTECHNOLOGY',1,3) FROM DUAL;
So, from the above query, we get the “OCP” as output.
3. LENGTH
The LENGTH function calculates the length of a string as a numeric value. Suppose we have a string like “OCPTECHNOLOGY” and we just want to count the letters of the sting, so you can use the length function.
SQL> SELECT LENGTH('OCPTECHNOLOGY') FROM DUAL;
The output is 13.
4. INSTR
The INSTR function shows the position of a given character in number. For example, you want to find out the position of “T” later from the “OCPTECHNOLOGY” string.