Q:

UPDATE Column data with the closest value from another table on oracle

I have this table "table_1"
Column
1039
3900
2345

And Table_2 
Column
1038
1090
3903
4502
2340
2900
4500

i need to update the table_1 with the most closest value from table 2 to be like this : 
1039 => 1038
3900 => 3903 

and so on . 
Thanks

A:

Cross Join the tables, find the column in Table2 with the least difference. 
Use the FIRST aggregate function to get this column. 
SELECT a.col
    ,MIN(b.col) KEEP (
        DENSE_RANK FIRST ORDER BY (ABS(a.col - b.col))
        ) as col2
FROM Table1 a
CROSS JOIN Table2 b
GROUP BY a.col;

Demo
To update the table, use a correlated update from the above select. 
update table1 o set col = ( SELECT 
    MIN(b.col) KEEP (
        DENSE_RANK FIRST ORDER BY (ABS(a.col - b.col))
        ) as col2
FROM Table1 a
CROSS JOIN Table2 b
Where a.col = o.col
GROUP BY a.col );

