Suppose the use of FK is not possible in OpenEdge at the SQL level.Īt the OpenEdge ABL level to implement something like referential integrity I have to write an ABL procedure for the trigger to delete, create, etc. Am I wrong again? If I'm wrong, what is this article for? It is a bug? Where it is a bug, in the article or in my code above? /SQL-command-to-add-a-FOREIGN-KEY-constraint-to-an-existing-table-fails-with-the-error-7545įrom this article I conclude that it is still possible at the SQL level. There also use the PUB scheme in the example. Judging by this article, this is possible, but only need to be sure that the table columns chosen as primary or foreign key do not accept NULL values by making them mandatory. I wanna to create a foreign key between Order.Cust_Num and Customer.Cust_Num fields. Both fields have the MANDATORY option:ĪDD FIELD "Cust_Num" OF "Customer" AS characterĪDD FIELD "Name" OF "Customer" AS characterĪDD FIELD "Order_Num" OF "Order" AS characterĪDD FIELD "Cust_Num" OF "Order" AS character These are the data definitions for my two test tables. Make sure that the table columns chosen as primary or foreign key do not accept NULL values by making them mandatory. SQL Error : No matching key defined for the referenced table (7545)Ĭolumns defining a primary or foreign key must not accept the NULL value. I do it in the Dbeaver. But I got the following error: I am trying to add a foreign key to my existing table using by SQL command.ĪLTER TABLE PUB."Order" ADD CONSTRAINT ORDER_CUSTOMER_FK FOREIGN KEY ("Cust_Num") REFERENCES PUB."Customer"("Cust_Num")
0 Comments
Leave a Reply. |