- Returns the number of characters in a value.
- If the string has data type CHAR, the lenght includes all trailing blanks.
- If the string is NULL, it returns NULL.
Syntax :
LENGTH( Column/Expression)
Examples :
1.
SELECT 'ORACLE' String,
LENGTH('ORACLE') Length
FROM DUAL;
2.
SELECT
LENGTH (Ename)||' CHARACTERS EXIT IN '|| INITCAP(Ename) ||"'s name.'
AS "Names and Lengths"
FROM Emp;
3.
SELECT INITCAP(Ename), Job
FROM Emp
WHERE LENGTH(Job) =7;
4.
SELECT INITCAP(Ename), Job
FROM Emp
WHERE SUBSTR(Job,4,LENGTH(SUBSTR(Job,4,3))) = 'AGE';



0 comments
Post a Comment
Do comment to make this blog better