具有多个选择和插入的匿名SQL / PL块

时间:2018-11-30 22:38:10

标签: oracle11g

如何运行此SQL PL块并同时插入。我试过了,根本没有用。我是编码方面的新手,刚下学,这是我的第一份工作,请帮助我。

Select a.col1,a.col2, a.col3, a.col4, b.col5 
from Table1 a 
Join Table2 b on a.col1 = b.col1

insert into mass table col1, col3, col4 
     values ('1', '3', '4') 
insert into Report Table col2, col5  
     values('10','20')
insert into Check_log table col1, col2, col3, col4, col 5 error msg, successful, duplicate  
     values('1','3', '4','10', '20','failed to load', '', '')

Select b.col1,b.col2, c.col3, c.col4, c.col5  
from Table1 b 
Join Table2 c on a.col2 = b.col2

insert into mass table col1, col3, col4 
       values ('2', '80') 
insert into Report Table col3, col5 
       values('3','20')
insert into Check_log table col1, col2, col3, col4, col 5 error msg, successful, duplicate  
       values('1','3', '4','10', '20','', 'Successful', '')


Select f.col1,d.col2, d.col3, f.col4, d.col5  
from Table1 d 
Join Table2 f on f.col3 = d.col3

insert into mass table col1, col1, col4 
       values ('1', '4') 
insert into Report Table col2, col3  
       values('10','3')
insert into Check_log table col1, col2, col3, col4, col5 error msg, successful, duplicate 
       values('1','3', '4','10', '20','', '', 'duplicate')

0 个答案:

没有答案