在我的桌子product
我有一栏:product_name
与VARCHAR
型和100尺寸:product_name varchar(100)
如何定义VARCHAR列以支持特殊字符?
当我尝试使用特殊字符插入一个名字像这样的:
°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%°°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°%âä°
我得到这个错误:
ERROR : org.hibernate.util.JDBCExceptionReporter:78 : logExceptions() : Error for batch element #1: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null, DRIVER=3.57.82
我的product_name列可以有100个字符,对于''是1个字符。
DB2中是否有另一种类型(varchar
除外),将其设置为product_name
列?
因此,我可以执行此查询:
alter table product alter column product_name set data type otherType(100);
哪个操作系统和哪个DB2版本?字符和字节是两种不同的措施。解决方案取决于我的问题的答案或简单地增加“100”。 – MichaelTiefenbacher
[DB2 VARCHAR unicode数据存储]的可能重复(http://stackoverflow.com/questions/7385183/db2-varchar-unicode-data-storage) –
@MichaelTiefenbacher,我正在使用DB2 10.5.5 – junior