Custom Search
www.rocket99.com : Technical Guides Sybase Oracle UNIX Javascript


Technical Guides
Sybase
Oracle
UNIX
Javascript




Of Interest

Business Intelligence and Analytics



Oracle Training





Oracle » PL-SQL » Join » Update

Update from one table to another

     




Oracle Update - Where You Need to Join.

Oracle does not support updating one table from another, in a join ;
it does support updates via sub-selects, which are a bit strange,
but seem to work.

In the below example, TWO columns on the target table are updated
from two columns on another table.






set serveroutput on size 4444

create or replace procedure P_invoice_sync (v_invoice_id in integer)
is

begin


update invoice t1
set (inv_total, inv_tax) =
( select inv_total,inv_tax from import_invoice_data t2
where t2.invoice_id = v_invoice_id and
t1.invoice_id = t2.invoice_id and
t1.client_id = t2.client_id ) ;


commit;


end;
/


show errors








Oracle : Related Topics


Sybase Web Site
Sybase iAnywhere Mobile Web Site
Oracle Enterprise Web Site



Get the latest Rocket99 news and tech tips via






Site Index About this Guide to Sybase, Oracle, and UNIX Contact Us Advertise on this site




Copyright © 2016 Stoltenbar Inc All Rights Reserved.