Hello
I have been use mysql ver 3.23.53, also I'm using on DELETE CASECADE. It seems working fine.


I believe UPDATE CASECADE is working from version 4.0.8.

-----------------------------------------------------------------------------------------
I have following problem (purchaseOrder_items::orderNum reference purchaseOrder_items; ::orderNum)


select * from purchaseOrder;
+----------+-----------------+------------+-----------+------------+
| orderNum | orderSupplierID | orderDate  | orderNote | orderTotal |
+----------+-----------------+------------+-----------+------------+
| 123      | k1              | 2003-03-26 | testing   |        250 |
+----------+-----------------+------------+-----------+------------+
1 row in set (0.00 sec)

mysql> select * from purchaseOrder_items;
+----------+--------+-----------+----------+---------------+
| orderNum | itemID | itemList  | itemCost | itemDelivDate |
+----------+--------+-----------+----------+---------------+
| 123      | book1  | equipment |      100 | 2003-03-26    |
| 123      | book2  | equp      |      150 | 2003-03-26    |
+----------+--------+-----------+----------+---------------+
2 rows in set (0.00 sec)

mysql> update purchaseOrder_items set orderNum="567" where orderNum="123";
ERROR 1216: Cannot add a child row: a foreign key constraint fails
mysql>
mysql>
mysql> update purchaseOrder set orderNum="567" where orderNum="123";
ERROR 1217: Cannot delete a parent row: a foreign key constraint fails
--------------------------------------------------------------------------------------

I can NOT edit the orderNum. It seems the only way to edit the orderNum is, delete the children (purchaseOrder_items) or move to a tem table, then edit the parent orderNum and add back the children with the new orderNum, This is to many transactions.

Is there any better way to edit foreign key values

Of course I can switch to the a upper mysql version(4.0.8), if that is the only solution, which one is recommendable??

Thanks



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to