I have a table with numeric column:
create table test (a number(2,0));
Next I want to create a virtual column based on column a:
alter table test add (b varchar2(3) as ('A:'||to_char(a)));
This results in error:
ORA-12899: value too large for column "B" (actual: 12, maximum: 42)
Why do I get this error? This works if I replace to_char with substr, but I'm curious how does Oracle determine the "actual" and "maximum" values?
I suspect the maximum value is related to maximum precision of numeric types (Oracle ignoring the data type precision), but I still don't quite understand this error. Character set is UTF-8.