answersLogoWhite

0

-- two dashes mean a comment in DB2 for VM and z/OS

-- 1st design your table - considered optional

-- 2nd declare your table - maditory. You still can not alter a table that

-- does not exist

-- 3rd alter the table to add the foreign key

-- DB2 for FOREIGN KEY

ALTER TABLE owner.Tablename

ADD CONSTRAINT name FOREIGN KEY (column name(s) )

REFERENCES REDBA.RESF_FINAL_CARD (column name(s) )

ON DELETE RESTRICT -- means stop them

or

ON DELETE cascade -- Cascade means to delete everthing here

or

ON DELETE SET value -- update the value of the column

;

-- note since you are doing DDL not dml the commit is implicit!! so

-- there is no COMMIT WORK needed

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions