以下是我的存储过程
DROP PROCEDURE `addRecord`//
CREATE DEFINER=`root`@`localhost` PROCEDURE `addRecord`(company varchar(3000),name
varchar(3000),title varchar(3000),metro varchar(3000),city varchar(3000),email
varchar(3000),phone varchar(3000),industry varchar(3000))
BEGIN
insert ignore into record_data (company,name,title,metro,city,email,phone,industry)
values(company,name,title,metro,city,email,phone,industry);
END
我的主要任务是检查重复的条目。如果我为所有字段提供一些值,它工作正常。但是,如果我从java提供某些字段为null,则会插入一个新行。而不是消除重复。 例如
if i use following statement it dosent insert an entry if it exists
record.addRecord("abc", "a", "abc", "a","b","ostwal@gmail.com", "518- 220", "intl");
but if use
record.addRecord("abc", "a", "abc", null,null,"ostwal@gmail.com", "518- 220", null);
it inserts another row even if it already exists.