I have two tables and one function:
Table1 contains shop_code,batch_id
shop_code| batch_id | regstriy_id
123 | 100 | 12
124 | 100 |13
125 | 100 |12
Table2 contains shop_code,shop_name
shop_code| shop_name
123 | need to populate
124 | need to populate
125 | need to populate
Function1 take parameter registry_id
from table1 and returns shop_name
Table2 shop_name
is empty I want to populate against the shop_code
.
It will be great if someone can help, I am using Oracle.
I tried this but not working
update TABLE2 set T2.SHOP_NAME = T.SHOP_NAME
from(
select GET_shop_name(t1.regitry_id) as shop_name ,
t1.shop_code shop_code
from TABLE1 T1
) t where t.shop_code = t1.shop_code;