* dan orlic
> How, in a sql script, do I gracefully fail an insert? For example, I
> insert a record that has an primary key of 1, and it already exists. I
> want my script to
> Move down to the next record, not fail out. Thanks!
See the IGNORE option of the INSERT statement:
http://www.mysql.
# if using perl and DBI pseudo code
die $ERROR if ($dbh->errstr() && $dbh->errstr() !~ /Duplicate Error/);
If $dbh->errstr() =~ /Duplicate Error/
do your specified logic
Else
Return inserted id
- Dathan Vance Pattishall
- Sr. Programmer and mySQL DBA for FriendFinder Inc.
- http://fr
At 13:44 -0500 10/13/03, dan orlic wrote:
How, in a sql script, do I gracefully fail an insert? For example, I
insert a record that has an primary key of 1, and it already exists. I
want my script to
Move down to the next record, not fail out. Thanks!
If you're executing the script with the mysq