2013-07-18 2 views

Antwort

27
alter table tab1 
add c1 number(20) constraint tab1_c1_fk references tab2(c2) 
; 

c1 - neue Spalte in der Tabelle tab1 mit dem FK tab1_c1_fk auf dem Tisch tab2 Spalte c2

+2

Mindestens ab 11 ist 'constraint constraint_name' nicht unbedingt notwendig. Es könnte einfach 'add c1 Nummer (20) Referenzen tab2 (c2)' sein. – jpmc26

0
ALTER TABLE CODE_LIST_TYPE_ERROR 
ADD ID_CODE_LISTS VARCHAR2(50) NOT NULL 
CONSTRAINT CODE_LIST_TYPE_ERROR_FK REFERENCES CODE_LISTS(ID); 

oracle Abfragetabelle zu ändern und neue Spalte hinzufügen, die refrence einer anderen Tabelle ist