ALTER TABLE command?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chota
    New Member
    • Aug 2008
    • 1

    ALTER TABLE command?

    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.
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    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)

    Comment

    Working...