我有下面的插入查询
INSERT INTO PUBLIC.STAFF(NAME, PICTURE,EMAIL) VALUES
('samplePic', X'89504e470d0a1a0a0000000d4', 'some@domain.com');
如何修改上面的图片属性字符串值(X'89504e47
到\x89504e47
),最后的查询就像是。
INSERT INTO PUBLIC.STAFF(NAME, PICTURE,EMAIL) VALUES
('samplePic', '\x89504e470d0a1a0a0000000d4', 'some@domain.com');
答案 0 :(得分:0)
尝试使用replace
这样的方法:
String query = "INSERT INTO PUBLIC.STAFF(NAME, PICTURE,EMAIL) VALUES('samplePic', X'89504e470d0a1a0a0000000d4', 'some@domain.com')";
query = query.replace("X'89504e47", "'\\x89504e47");
输出:
INSERT INTO PUBLIC.STAFF(NAME, PICTURE,EMAIL) VALUES('samplePic', '\x89504e470d0a1a0a0000000d4', 'some@domain.com')
答案 1 :(得分:-4)
你应该写如下。
UPDATE PUBLIC.STAFF SET PICTURE ='x89504e47',其中NAME ='samplePic';