Why do I receive a 'General error' when trying to use INSERT with Database Toolbox 3.0 (R14)?
1 view (last 30 days)
Show older comments
I am using INSERT to add a row to one of the tables in a database. This works the first time I call INSERT, but subsequent calls result in an error message. For example, my first call is:
insert(conn,'productTable',{'productNumber','unitCost'},{1004,3.45});
This call works, but subsequent calls to INSERT result in the following error:
??? Error using ==> database.insert
General error
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This error results when the database has a primary key and you try to insert a row with a non-unique primary key. A primary key is a unique identifier in a table and prevents a row from being inserted that has the same primary key value as another row. A primary key can include values from one or more fields. When you try to add a row with a value in the primary key field that is the same as an existing value in a primary key field, the insert fails and an error appears.
0 Comments
More Answers (0)
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!