Reputation: 56679
If you create an Oracle table using "create as" where one of your fields is null you will get the error:
ORA-01723: zero-length columns are not allowed
Example query:
create table mytable as
select
field_a,
null brand_new_field
from anothertable;
How can you get around this?
Upvotes: 6
Views: 11514
Reputation: 93
This is one of the way how to solve it.
create table mytable as
select
field_a,
' ' brand_new_field
from anothertable;
Upvotes: 0
Reputation: 56679
Figured it out need to use cast(null as datatype)
create table mytable as
select
field_a,
cast(null as varchar(1)) brand_new_field
from anothertable;
Some more info here.
Upvotes: 11