sql_txt := 'merge into STUDENT_NEW_JAY using STUDENT_JAY on(STUDENT_NEW_JAY.name=STUDENT_JAY.name) when matched then update set ' || sql_txt_columns_update|| ' when not matched then insert (' || sql_txt_columns ||') values(' || sql_txt_columns_insert || ') where STUDENT_JAY.name=张三'; execute immediate sql_txt; commit; exception when others then rollback; end;
------解决方案-------------------- 一 ') where STUDENT_JAY.name=''张三''';
二
v_name varchar2(40); begin v_name := '张三'; ') where STUDENT_JAY.name=:p'; execute immediate sql_txt using v_name;
------解决方案-------------------- where STUDENT_JAY.name=张三';
字符串要用单引号括起来,但是因为本来就在单引号里面,所以单引号前面再加个单引号转义。
SQL code
where STUDENT_JAY.name=''张三''';
------解决方案--------------------