Update row with multiple row in another table Error : ORA-01427: single-row subquery returns more than one row? I have Table A with 1 row and wanted to update it from another table (which has 3 rows for it and I can take any one of them).

Table A
-----------
TrnID | trn_Status
 2345 | null
 9876 | null
 9878 | null

Table B
-----------
TrnID | trn_Status
 2345 | 2
 2345 | 2
 2345 | 2
 9876 | 4
 9876 | 4
 9878 | 2


I am facing error when i try to do something like this 

UPDATE TableA tabA
SET    ( tabA.trn_status ) = (
                            SELECT trn_status 
                            FROM   TableB tabB 
                            WHERE  ( 
                                        tabA.trn_id = tabB.trn_id                                   
                                    )                                   
                         ) ;
Community wiki answer:

Since there are several rows in the result you need to decide which one to use as the new value for trn_status: 


Limit your subquery with FETCH FIRST 1 ROW ONLY.
If you can guarantee that all corresponding records are full duplicates, use DISTINCT.
Using min, max, avg aggregate would be other possibilities.