Connecting Tech Pros Worldwide Help | Site Map

ALTER TABLE command?

Newbie
 
Join Date: Aug 2008
Posts: 1
#1: Aug 4 '08
Hi,

I am currently working with a database, and I am being asked to delete a row from this table. let's call it department with the attributes (dcode CHAR(20), dname CHAR(20)).

Now i have to delete a row that a user inputs via JDBC regarding the dcode.
However I can't do this because the table department is not "ON DELETE CASCADE", and there are other attributes in other tables in this database where that column is a foreign key to that dcode. (ie: they refer to the column dcode in the department table). I was wondering if there was a way to add this constraint to this table.

I tried looking up the ALTER TABLE command but I am not sure how it works.

If any one can help me with this problem, that would be great.

Thank You,
Chota.
Moderator
 
Join Date: Dec 2006
Location: Europe
Posts: 292
#2: Aug 7 '08

re: ALTER TABLE command?


I'm not sure it ALTER TABLE allows to add CASCADE removing to a table. You can solve this writing a rule or a trigger (or recreate table with CASCADE removing)
Reply