REPLACE Function in SQL

Published on by LakshmiSaahul,Dhana Royal

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
To be informed of the latest articles, subscribe:
Comment on this post