oracle 中关于update select 语句的有关问题
oracle 中关于update select 语句的问题
是这样的,我已经使用select 连接多表取得想要更新的记录集,共有139条记录,FAssGrpID值都是'ZZW0XxLMQjqiyV/6c9PO2kGKbLs='
现在想在这查出的139条记录中更新 FAssGrpID值为其它值,在oracel中应该怎么写语句呢??求助呀~~
------解决方案--------------------
是这样的,我已经使用select 连接多表取得想要更新的记录集,共有139条记录,FAssGrpID值都是'ZZW0XxLMQjqiyV/6c9PO2kGKbLs='
现在想在这查出的139条记录中更新 FAssGrpID值为其它值,在oracel中应该怎么写语句呢??求助呀~~
- SQL code
select tgv.fid,tgv.fbookeddate,tgv.fnumber,tgve.flocalamount,tgve.fid,tgve.faccountid,tgvar.fid,tgvar.fentryid,tgvar.fassgrpid,tgvar.fbillid from T_GL_VoucherAssistRecord tgvar, T_GL_Voucher tgv,T_GL_VoucherEntry tgve where tgvar.FAssGrpID='ZZW0XxLMQjqiyV/6c9PO2kGKbLs=' and tgvar.fbillid=tgv.fid and tgv.fcompanyid='X6LYi/UfSGuuUA9ZNwxJasznrtQ=' and tgvar.fentryid=tgve.fid and tgve.faccountid='TIwPYRKyRUy4gNse9h1Z+p2pmCY=' order by fbookeddate
------解决方案--------------------
- SQL code
update T_GL_VoucherAssistRecord t set t.FAssGrpID=? -- 更新 FAssGrpID值为其它值 where (t.fid,t.fentryid,t.fassgrpid,t.fbillid) in ( select tgvar.fid, tgvar.fentryid, tgvar.fassgrpid, tgvar.fbillid from T_GL_VoucherAssistRecord tgvar, T_GL_Voucher tgv, T_GL_VoucherEntry tgve where tgvar.FAssGrpID = 'ZZW0XxLMQjqiyV/6c9PO2kGKbLs=' and tgvar.fbillid = tgv.fid and tgv.fcompanyid = 'X6LYi/UfSGuuUA9ZNwxJasznrtQ=' and tgvar.fentryid = tgve.fid and tgve.faccountid = 'TIwPYRKyRUy4gNse9h1Z+p2pmCY=' )
------解决方案--------------------
请参考:
- SQL code
UPDATE T_GL_VoucherAssistRecord SET FAssGrpID = 更新后的值 WHERE EXISTS (select 1 from T_GL_VoucherAssistRecord tgvar, T_GL_Voucher tgv,T_GL_VoucherEntry tgve where tgvar.FAssGrpID='ZZW0XxLMQjqiyV/6c9PO2kGKbLs=' and tgvar.fbillid=tgv.fid and tgv.fcompanyid='X6LYi/UfSGuuUA9ZNwxJasznrtQ=' and tgvar.fentryid=tgve.fid and tgve.faccountid='TIwPYRKyRUy4gNse9h1Z+p2pmCY=');