On Mon, 26 Jul 2004 17:47:37 +0100, Adaikalavan Ramasamy <[EMAIL PROTECTED]> wrote: > This seems more like the solution I want. I am using perl-DBI and when > there is an error (i.e. duplicate insert), the rest of the scrip it not > executed. But this is gives me the following error. What am I doing > wrong ? > > mysql> desc tb; > +-----------+-------------+------+-----+---------+----------------+ > | Field | Type | Null | Key | Default | Extra | > +-----------+-------------+------+-----+---------+----------------+ > | myID | int(11) | | PRI | NULL | auto_increment | > | firstname | varchar(10) | YES | MUL | NULL | | > | lastname | varchar(10) | YES | | NULL | | > +-----------+-------------+------+-----+---------+----------------+ > 3 rows in set (0.00 sec) > > mysql> INSERT INTO tb (firstname, lastname) VALUES ('Jack', 'Doe') ON > DUPLICATE KEY UPDATE lastname = lastname; > ERROR 1064: You have an error in your SQL syntax near 'ON DUPLICATE KEY > UPDATE lastname = lastname' at line 1
You are probably running an older version of mysql that doesn't support this. Try "insert ignore". > > Alternatively, I am looking for 'try' equivalent in perl, so that if the > insert is duplicate, the rest of the script is still run. Thank you. eval. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]