为什么这么问呢 主键是不能重复的,和varchar2还是number无关 怎么解决要看你怎么处理,如果要插入的数据的主键在第二张表中已经存在的话,你要怎么处理,是不插入,还是修改已存在的记录 可以试试用merge into merge into table2 a using table1 b on (a.id=b.id) when matched then update set a.col1=b.col1,a.col2=b.col2,a.col3... when not matched then insert values(b.id,b.col1,b.col2....) 如果不处理,且数据库为10g以上版本,when matched部分可以不填写 根据需要来修改
主键是唯一的,不能重复, 你插入的数据和现在的数据有相同的吗?简单的描述下表结构和你的操作...
---------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
QQ 群:62697716
主键是不能重复的,和varchar2还是number无关
怎么解决要看你怎么处理,如果要插入的数据的主键在第二张表中已经存在的话,你要怎么处理,是不插入,还是修改已存在的记录
可以试试用merge into
merge into table2 a
using table1 b
on (a.id=b.id)
when matched then
update set a.col1=b.col1,a.col2=b.col2,a.col3...
when not matched then
insert values(b.id,b.col1,b.col2....)
如果不处理,且数据库为10g以上版本,when matched部分可以不填写
根据需要来修改
用3楼的 merge into 可以搞定你的问题