ORA-06502:PL/SQL:numeric or value error:character string buffer too small【解决方法】

今天爱分享给大家带来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)

人已赞赏
Python

Get https:/registry-1.docker.io/v2/:net/http:TLS handshake timeout【解决方法】

2021-1-6 11:35:30

Python

socket.error:[Errno 99]Cannot assign requested address【解决方法】

2021-1-6 11:48:07

'); })();