Loading

ORA-01406

今天某客户询问ORA-01406报错应该如何处理,查看信息如下,这里提示列被截断

这里提示的也很明显,使用一致的字符类型避免被截断

[oracle@rds ~]$ oerr ora 1406
01406, 00000, "fetched column value was truncated"
// *Cause: The fetched column values were truncated.
// *Action: Use the right data types to avoid truncation.

出现这种情况,也比较好判断,建议客户检查如下信息

1.变量值和表字段类型是否一致

2.数据库字符集与客户端字符集是否一致

 

网上也百度了下,搜索到了Oracle ask tom如下信息

HOW TO ASK A QUESTION:

1. Provide a detailed description of your problem. Include an overview of what you're trying to do. The steps you took that lead to the error. And anything you've tried to solve the issue.

2. Post a complete test case showing your problem. This is something we can copy-paste into our environment to reproduce your issue. This includes tables, data and anything else necessary for us to run your code (without editing it!)

3. DON'T SHOUT!

Anyway, on to the error. As the error implies, the value from a column has been shortened. To solve this, as the docs say

"Use the right data types to avoid truncation."

https://docs.oracle.com/en/database/oracle/oracle-database/18/errmg/ORA-00910.html#GUID-D9EBDFFA-88C6-4185-BD2C-E1B959A97274__GUID-4101690C-8DFD-4EF9-A5B5-63A6507C00EB

So you need to look at your code. The problem happens when there's a mismatch between the variable data type and the data type of the column.

To help you further, please provide the information from steps 1 & 2 above.

Thanks!

 

posted @ 2023-03-06 22:41  李行行  阅读(614)  评论(0编辑  收藏  举报