sql - Oracle merge and third party tables -


i work merge operation in example:

http://docs.oracle.com/cd/e11882_01/server.112/e26088/statements_9016.htm

how can make insert third party table inside "when matched" , "when not matched" clauses?

update: may possible set flags inside clauses? using @ next procedure steps - execute insert ...

considering want benefit merge clause update table, suggestion flags pretty idea imo. suppose want merge tab_a , tab_b tab_c, 1st need alter table tab_a add (flag varchar2(1));.

then merge consists in setting flags:

merge tab_a using (tab_b) b on (...) when matched update set a.flag = 'u' when not matched insert (..., flag) values (..., 'i') ; 

you can update tab_c like:

insert tab_c select ... tab_a a.flag = 'i'; 

and same kind of update lines 'u' flag. don't forget reset flag in tab_a when you're finished !


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -