insert into a (select * from b where b.productID not in (select productID from a));
insert into a Select * from b where a.productID<>b.productID
select * from product union select * from product_old b where not exists(select 1 from product where productID=b.productID)
to beckhambobo(beckham) 我要INSERT INTO,你的语句倒是查出了很多东西。
在oracle sql中是没有SELECT INTO(只有在PL/SQL里,它表示将select的值赋予一个变量),他和sybase不一样,在sybase中,select * into a from b(其中a不能在数据库中存在),表示先创建一个和b表结构相同的a表,然后将b表的所有内容,导入到a表中。 你的那个语句在oracle中,可以用create table table_name as select * from roduct a,product_old b where a.productID<>b.productID
1. select * from huatest; SELECT UPDATE INTO WHERE a b c d a2 b c d a3 c c c 2. insert into huatest select concat(rtrim("SELECT"),'b'),"UPDATE","INTO","WHERE" from huatest;3. SELECT UPDATE INTO WHERE a b c d a2 b c d a3 c c c ab b c d a2b b c d a3b c c c
insert into product select * from product_old b where not exists(select 1 from product where productID=b.productID)
如果你要将一个表的数据插入另一个表的话,
insert into a (select * from b)
表有唯一值,会产生错误。TO jiezhi(西域浪子)
两表有重复的数据,PRODUCTID是主键,按你的方法有错:OR 位于第 1 行:
-00001: unique constraint (ORCL.PRODUCT_UK01031931248510) violated
union
select * from product_old b where not exists(select 1 from product where productID=b.productID)
我要INSERT INTO,你的语句倒是查出了很多东西。
你的那个语句在oracle中,可以用create table table_name as select * from roduct a,product_old b where a.productID<>b.productID
SELECT UPDATE INTO WHERE
a b c d
a2 b c d
a3 c c c 2. insert into huatest
select concat(rtrim("SELECT"),'b'),"UPDATE","INTO","WHERE" from huatest;3.
SELECT UPDATE INTO WHERE
a b c d
a2 b c d
a3 c c c
ab b c d
a2b b c d
a3b c c c
select * from product_old b where not exists(select 1 from product where productID=b.productID)