这样的事情:
(v_city,v_address v_name已经是我已声明过的变量)
insert into table1 (id, name, address, city)
select table1_seq.nextval, name, address, city from table1 where city=v_city;
但如果name = v_name,我希望将地址更改为v_address。
答案 0 :(得分:1)
这个怎么样:
insert into table1 (id
,name
,address
,city)
select table1_seq.nextval
,name
,case when name = v_name then v_address else address end
,city
from table1
where city = v_city;