2016-05-24 14 views
2

Wenn Sie erstellen eine Oracle-Tabelle mit "erstellen, wie" wo eines Ihrer Felder null ist, dass Sie den Fehler:Oracle "create table als" Nullwert

ORA-01723: zero-length columns are not allowed

Beispiel query:

create table mytable as 
select 
    field_a, 
    null brand_new_field 
from anothertable; 

Wie können Sie das umgehen?

Antwort

2

Figured es notwendig cast(null as datatype)

create table mytable as 
select 
    field_a, 
    cast(null as varchar(1)) brand_new_field 
from anothertable; 

ein paar mehr Infos here verwenden heraus.

0

Dies ist einer der Wege, wie Sie es lösen können.

create table mytable as 
select 
    field_a, 
    ' ' brand_new_field 
from anothertable;