Reputation: 435
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.
Upvotes: 5
Views: 7992
Reputation: 55514
REPLACE
is a function, not a procedure, so use the following syntax:
templateMessage3 := replace(templateMessage3, 'FNAME', 'Lilly');
Upvotes: 13
Reputation: 2083
REPLACE is a sql function
So you'd need something like:
SELECT replace(:templateMessage3, 'FNAME', 'Lilly')
INTO templateMessage3
FROM dual;
(I don't have an Oracle install, so can't double check the syntax, but should be enough to get you started)
Upvotes: 0