数据库端防止并发的SQL语句 插入时就判断是否存在

insert into `aaa` (
  `APP_TYPE_ID`,
  `APP_TIME_ID`,
  `CREATE_USER`,
  `APPOINTMEN_DATE`
) 
select 
  "2C8F50808C3B49B1A9DDA467AEA1D475",
  "F982F0AF7DB54A87BA8F3CE189A6E66F",
  "55aaec489ea9458b99c920828c53755a",
  "2016-06-16" 
from
  dual 
where not exists 
  (select 
    * 
  from
    `aaa` 
  where APPOINTMEN_DATE = '2016-06-18')


插入之前判断是否存在。

你可能感兴趣的:(Sql)