—–更新表,更新多个字段
update channel_crmcode_interface c
set (c.region_code, c.cha_client_type, c.channel_id, c.channel_name, c.channel_code)
= (select cpb.region_code,
'16',
cpb.partner_busihall_id,
cpb.partner_busihall_name,
cpb.partner_busihall_code
from channel_partner_busihall cpb
where c.miscode = upper(cpb.miscode)
and cpb.state = 'Y')
where c.import_date = 20160126
and c.miscode is not null
and c.channel_id is null
and c.state = 1 ;
—更新表,关联多个条件
UPDATE rwd_ext_render r
set r.pay_month = null, r.pay_state = 0
where (r.chnl_id, r.sett_month, r.bsub_name, r.apply_money) IN
(SELECT a.chnl_id, a.sett_month, a.bsub_name, a.money FROM hutz a);
加字段
alter table 表名 add 字段名 VARCHAR2(12);
删除字段
alter table 表名 drop column 字段名;
改字段名
alter table 表名 rename column 旧字段名 to 新字段名;
加备注
comment on column 表名.字段名 is ‘描述’;