[英]Oracle SQL Insert statement for multiple tables
I have two tables Alpha_Setting
and Beta_View
as show below, 我有两个表
Alpha_Setting
和Beta_View
,如下所示,
Alpha_Setting
: Alpha_Setting
:
ID ( Sequence )
VIEW_ID
VIEW_TYPE
VIEW_VALUE
Beta_View
ID
VIEW_NAME
VIEW_TYPE
VIEW_CHECK
I would like to insert multiple ID from Beta_View
into VIEW_ID
in Alpha_Setting
, how should I correct my SQL 我想将多个ID从
Beta_View
插入VIEW_ID
中的Alpha_Setting
,如何更正我的SQL
insert into alpha_setting
('',
(select ID from beta_view where view_type = 'HERO' and (view_name = 'GREEN-All' or view_name = 'GREEN-New'),
'super_power',
'1000000');
Try this way: 尝试这种方式:
insert into alpha_setting (ID,VIEW_ID,VIEW_TYPE,VIEW_VALUE)
select '' /* or seq_name.nextval*/, ID,'super_power','1000000'
from beta_view
where view_type = 'HERO'
and view_name in('GREEN-All','GREEN-New','super_power','1000000');
or 要么
insert into alpha_setting (ID,VIEW_ID,VIEW_TYPE,VIEW_VALUE)
select '' /* or seq_name.nextval*/, ID,'super_power','1000000'
from beta_view
where view_type = 'HERO'
and (view_name = 'GREEN-All' or view_name in('GREEN-New','super_power','1000000'));
I'm not sure which condition with view_name
column is good for you. 我不确定
view_name
列的哪种情况对您有利。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.