Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve error: ORA-01406 fetched column value was truncated?

I am trying to execute this query:

select * 
  from gi_todo_isim 
 WHERE d_insercao >= '04-JUL-13' 
   AND d_insercao <= '25-JUL-13'

However this I am getting this error back:

ORA-01406 fetched column value was truncated

if I try to count how many columns exists:

select count(*) 
  from gi_todo_isim 
 WHERE d_insercao >= '04-JUL-13' 
   AND d_insercao <= '25-JUL-13'

The answer is 1661597 which is a big number. Can anyone give any solution how can I execute this query?

like image 858
Winter Avatar asked Oct 31 '25 07:10

Winter


1 Answers

The Oracle docs state this about the error code:

"Cause: In a host language program, a FETCH operation was forced to truncate a character string. The program buffer area for this column was not large enough to contain the entire string. The cursor return code from the fetch was +3.

Action: Increase the column buffer area to hold the largest column value or perform other appropriate processing. ORA-01406 is thrown when a FETCH was forced to truncate a column name or character string in host language programs. ORA-01406 is caused by the column's program buffer area which isn't large enough to hold the string in it's entirety, while the cursor return code is +3."

So, more than likely, you have a variable defined that is smaller in size than what the query is returning for a specific column. For example, you may be returning a varchar2(100) value into a buffer of size 50, or something similar. Since you don't show the host code, can't determine the exact offending field.

like image 72
OldProgrammer Avatar answered Nov 01 '25 19:11

OldProgrammer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!