Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use REPLACE function in PLSQL

I was wondering what is the appropriate way to call the REPLACE function described here, since I've created the statement below to test it but I'm getting an error:

DECLARE
 templateMessage3 VARCHAR2(50);
BEGIN
 templateMessage3 := 'Dear Mr./Madam FNAME';
  replace(templateMessage3, 'FNAME', 'Lilly');
  DBMS_OUTPUT.PUT_LINE(templateMessage3);
END;
/

Error:

PLS-00221: 'REPLACE' is not a procedure or is undefined

I am using Oracle 11g web interface.

like image 839
PrincessLilly Avatar asked Dec 14 '22 23:12

PrincessLilly


1 Answers

REPLACE is a function, not a procedure, so use the following syntax:

templateMessage3 := replace(templateMessage3, 'FNAME', 'Lilly');
like image 187
Peter Lang Avatar answered Dec 17 '22 13:12

Peter Lang