嗨,我正在用 PL SQL 编写一个过程,我需要在其中检索一个字符串并替换其中的一些值。我的问题是,如果我在其中传递变量,则替换语句不起作用。
tempPrewMonth VARCHAR2(20);
tempMonth VARCHAR2(20);
link VARCHAR(400);
//First of all i stored values in the variables tempPrewMonth and tempMonth
SELECT to_char((c.month-1),'09')
INTO tempPrewMonth
FROM dual;
SELECT to_char((c.month),'09')
INTO tempMonth
FROM dual;
//Replace the "tempPrewMonth" in the "link" variable with "tempMonth" value (this part doesn't work. I don't get any error but the replacement doesn't work)
EXECUTE IMMEDIATE 'select replace (:1,:2,:3)
from dual'
INTO link
USING link,tempPrewMonth,tempMonth ;
在此先感谢您的帮助。