I am using Oracle 11 and I have millions of records in my table. I am using a MERGE statement to update records from source table to target table.
At any moment while updating these millions of records, how can I log errors per record?
For example: I have successfully updated 400 records, but while updating 401st record, I am getting some error, so in this case how can I log something like
401st record and its failure cause
So that from these millions of records I can identify for which records the query has failed.

You don't get to pick your own error, but you can use the error_logging_clause. See Oracle documenation at https://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm#SQLRF01606.
You will first need to create an error log table with DBMS_ERRLOG. At the end of your merge statement you need to tack on