我這裡有t1,t2,t3三個表,當根據t3和t2中的某些條件做出的判斷成立時,向t1和t2中添加數據,能不能這麼寫
insert all
into t1(t1.column1,t1.column2) values(A,B)
into t2(t2.column1,t2.column2) select t3.column1,
t3.column2 from t3
where not exists
(select 1 from t2,t3 where t2.column1=t3.column1
and t2.column2=t3.column2);
大概就是這樣子了,t1的數據是具體的字符,t2的數據是從t3裡查到的。
大概試驗了下 應該是沒問題的代碼如下
create table student(
sname varchar2(10) not null,
sage number(3)
);
create table course(
cname varchar2(10) not null,
cid number(3)
);
insert into student values('YES',14);
commit;
select * from student;
insert all
into student(sname,sage) values('ABC',12)
into course(cname,cid)
select t3.sname,
t3.sage from student t3
where 2>1;
commit;
select * from student;
select * from course;