今天爱分享给大家带来ORA-06502:PL/SQL:numeric or value error:character string buffer too small【解决方法】,希望能够帮助到大家。
用python运行django项目,用orm查询集查询时,出现这个错误:
django.db.utils.DatabaseError: ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at line 1
输入关键字模糊查询遇到的错误,
word='笑' all_user = User.objects.filter( desc__icontains=word )
模型
class User(BaseModel): # 用户信息 name = models.CharField(u'帖子名称', max_length=100) desc = models.TextField(u'帖子描述')
解决办法:
用原生sql模糊查询即可:
sql = """select * from t_user where desc like '%%%s%%' """ % word all_user = exe_sql_all(sql, db_name=RDKM_DB) print(all_user)