0

I have a table with a column of length varchar(500) but when I try writing to this table from R, I am presented with an error of that this column exceeds the maximum number of characters, ie (actual: 295, maximum: 255).

How do I fix this, or how do I expand my character length?

joeyops
  • 51
  • 5
  • 1
    Are you sure you're writing to the column you think (in the table/schema/database you think)? It seems unlikely that it would report 255 if the actual size is 500. (Also, it doesn't really impact this, but you might want to check if the column 500 chars or 500 bytes.) – Alex Poole Feb 04 '21 at 23:50

1 Answers1

0

Difficult to answer because your context is not really accurate.

Depending on which function you use, it runs CREATE TABLE before appending to it. At this time it may use oracle default (255 character) for a character column.

For this task, I create my table first in my schema and only after that I use DBI::dbWriteTable with append = TRUE to just add new rows. With append = FALSE, the table is first "regenerated" or something, created temporarily with default length 255 char columns (if tibble column is char) before appending to your target table. The error comes here for me. Same context I think.

As previously said, you also have to check for non ASCII character in this context (when some columns length are > 500 for instance because of non ASCII charset).

Guillaume
  • 606
  • 3
  • 13