插入已经存在的数据时会报主键冲突,如何在插入语句中做判断,有冲突则不插入? RT 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select count(*) from table where id = ‘你要插入的数据'如果不存在则 insert否这不执行insert 谢谢,能写成一条sql语句吗? IF not EXISTS(select 1 from table where id = ‘你要插入的主键') insert into tb(.....) values(.....) insert into student(id)(select '1' as id from dual where not exists(select * from student where id = '1'))表 student主键 id插入 1 可以创建序列sequence,每次插入的时候从序列来获得他的主键值。 急求助 string类型的时间和character类型的时间如何转换? JOB长时间运行 Oracle中null问题 SQL语句能否以这样的时间为条件? 在线等待:oracle实例能mount上,但不能open.报告错误为:ora01092.急 如何在存储过程中返回cursor? 大哥救我!!! 视图的排序问题 求oracle 10g RAC 10204_vista_w2k8_x64_production_crs.zip 散分 马上结贴 表或视图不存在,急,在线等!!!
如果不存在则 insert
否这不执行insert
insert into tb(.....) values(.....)
(select '1' as id from dual where not exists(select * from student where id = '1'))
表 student
主键 id
插入 1