如何插入包含“;”的字符串
问题描述:
我正在使用SQL Developer 4.2.0.17.089 我需要使用包含“;”的字符串执行更新。 具体做法是:如何插入包含“;”的字符串
update <table_name> set <field_name>='....
<style>
.SectionHeading {
font-size: 12pt;
font-weight: bold;
font-family:Calibri;
color:#548DD4;
}
</style>
....'
where <condition>;
不管我做什么,我得到 SQL错误:ORA-01756:引用字符串的第一个分号
它完美地与SQL开发4.1.3.20工作后没有正确结束 。
有什么想法?
答
这似乎是SQL Developer 4.2中的一个错误(虽然我找不到任何与MoS或SD foum相关的东西);它在17.2也可以工作。由于sqlterminator
已过时且被忽略,我可以在4.2中看到解决它的唯一方法是将您的语句放在一个虚拟的匿名PL/SQL块中 - 当它知道PL/SQL块中的分号时,它不会被分号混淆, SQL上下文:
begin
-- start real code
update <table_name> set <field_name>='....
<style>
.SectionHeading {
font-size: 12pt;
font-weight: bold;
font-family:Calibri;
color:#548DD4;
}
</style>
....'
where <condition>;
-- end real code
end;
/
哪个不理想。如果可以,更好的解决方案可能是upgrade to the current version。