Oracle and the Ampersand (&)

本文介绍了在Oracle数据库中正确插入特殊字符&的方法。通常使用的转义字符在此处不起作用。文章提供了一种可行的解决方案:通过字符串连接操作将&符号加入到数据中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[url]http://www.etstiles.com/?q=node/7[/url]
Oracle and the Ampersand (&)
Submitted by ets04uga on Tue, 11/06/2007 - 3:28pm.

* Ampersand
* Escape Character
* Oracle

So I was looking around and couldn't seem to find out how to insert ampersand into an Oracle XE database, outside of SQL*Plus as in the following example:

INSERT INTO TABLE (COL1) VALUE ('A & B');

Normally one might try the standard backslash('\') as an escape character. One would be wrong.

I'm not sure of every possible solution, but found a quick (and seemlingy dirty) solution where the ampersand needs to be at the end next to a single quote. The following is the current solution I am using until a betters/best approach is found:

INSERT INTO TABLE (COL1) VALUE ('A &'||' B');

Hope this helps.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值