如何插入包含“;”的字符串

How to insert a string which contains an “;”

我正在使用 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 Developer 4.1.3.20 完美配合。

有什么想法吗?

这似乎是 SQL Developer 4.2 中的错误(尽管我在 MoS 或 SD 论坛中找不到任何相关内容);它在 17.2 中也可以正常工作。由于 sqlterminator 已过时并被忽略,我能看到在 4.2 中解决它的唯一方法是将您的语句包含在一个虚拟的匿名 PL/SQL 块中 - 它不会被分号混淆在 PL/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