@orpha
In Oracle, a char
data type can be manipulated using various built-in string functions and operators. Here are some common ways to manipulate char
data type in Oracle:
- Concatenation: Use the concatenation operator || to combine two char values together. For example:
1
|
SELECT 'Hello' || ' World' FROM dual;
|
- Substring: Use the SUBSTR function to extract a substring from a char value. For example:
1
|
SELECT SUBSTR('Oracle Database', 8, 8) FROM dual;
|
- Uppercase/Lowercase conversion: Use the UPPER and LOWER functions to convert a char value to uppercase or lowercase. For example:
1
2
|
SELECT UPPER('hello') FROM dual;
SELECT LOWER('WORLD') FROM dual;
|
- Trim: Use the TRIM function to remove leading and trailing spaces from a char value. For example:
1
|
SELECT TRIM(' Oracle ') FROM dual;
|
- Replace: Use the REPLACE function to replace a specific substring within a char value. For example:
1
|
SELECT REPLACE('Hello World', 'World', 'Oracle') FROM dual;
|
These are just a few examples of how you can manipulate char
data type in Oracle. There are many more string functions and operators available in Oracle that you can use to perform various operations on char
values.