用MySQL替换BLOB文本中的单词 [英] Replace a word in BLOB text by MySQL

查看:374
本文介绍了用MySQL替换BLOB文本中的单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个巨大的mysql表(称为tcountriesnew)和一列(称为slogen, blob type). 在每个slogen斑点中,我都想替换一个单词,例如:bananaapple.

I've got a huge mysql table (called tcountriesnew) and a column (called slogen, blob type). In each of those slogen blobs I'd like to replace a word, for example: banana to apple.

不幸的是,我试图用香蕉一词打印所有行,但是行不通.

Unfortunately I tried to print all the rows with word banana, and it did not work.

select * from tcountriesnew where slogen like '%banana%';

请帮助我.

  • 我错过了什么,我的查询出了什么问题?
  • 如何替换blob中的文本?

推荐答案

取决于替换"的含义;使用替换在选择中显示修改后的文本

Depends what you mean by "replace"; using replace to show modified text in select:

select replace(slogen, 'bananas', 'apples') from tcountriesnew where slogen like '%bananas%';

或更新表中的数据:

update tcountriesnew set slogen=replace(slogen, 'bananas', 'apples') where slogen like '%bananas%';

顺便说一句.为什么要在文本中使用blob?对于文本数据,应使用text类型,对于二进制数据,应使用blob类型.

BTW. Why are you using blob for text? You should use text type for textual data and blob for binary data.

这篇关于用MySQL替换BLOB文本中的单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆