REPLACE Function in SQL
What is REPLACE Function in SQL?
- Replaces the Characters in a string with required set of characters.
- It Translate Pattern by Pattern.
Example:
SELECT ' TECHBLOG' STRING, REPLACE('TECHBLOG','TECH','SQL') REPLACE FROM DUAL;
WHERE ENAME LIKE'%A%';
STRING
TRANSLATE
DEPTNO
BLAKE
BLUKE
30
CLARK
CLURK
10
ALLEN
ULLEN
30
WARD
WURD
30
MARTIN
MURTIN
30
ADAMS
UDUMS
20
JAMES
JUMES
30
SELECT ENAME,REPLACE(ENAME,'A') REPLACE,DEPTNO FROM EMP
WHERE ENAME LIKE'%A%';
- If we are not declared replacement string, Simply it removes that character 'A'.
Advertising