数据库: 禁止重复数据插入数据库的方法,没有主键和索引
数据库: 禁止重复数据插入数据库的方法,没有主键和索引
直接进行硬核判断,查询是否有一致的值,因为当前表中不存在主键
INSERT INTO ingate_standardsection SELECT
'扁平梯形',
'FlatTrapezoidSection.bmp',
3.75,
50,
25,
10,
'dddddd',
'udf'
FROM
DUAL
WHERE
NOT EXISTS (
SELECT
1
FROM
ingate_standardsection
WHERE
section_type = '扁平梯形'
AND section_bmp = 'FlatTrapezoidSection.bmp'
AND CONCAT( section_area, '' ) = '3.75'
AND CONCAT( section_dima, '' ) = '50'
AND CONCAT( section_dimb, '' ) = '25'
AND CONCAT( section_dimc, '' ) = '10'
AND section_from = 'udf'
)
页:
[1]