Insert into B_t_table (select a.tid, 0 from A_t_table a,B_t_table b where a.tid=b.tid(+) and b.value is null)
update B set B.value=(select A.name from A where A.tid=B.tid) where B.value is null;
update B b set b.value=(select a.name from A a where a.tid=b.id);