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

database, oracle, plsql, sql, sql-navigator

Solution

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.

Problem

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?

Original source