in rman we can check the backups details is it completed or failed with V$RMAN_BACKUP_JOB_DETAILS and v$RMAN_STATUS views.
if it is failed status is there any query to get that code from the database or we need to depend on the logs only. currently i don't have logs to get error code.
You can use v$rman_ouput.
Note: The v$rman_output view is memory-based so it will not persist thru a database restart (i.e will not recorded in the controlfile). The view can hold 32768 rows.
If you want keep all data from v$rman_output you have 3 option:
1. Use RMAN CATALOG on different database.
2. Use a trigger on the V_$RMAN_OUTPUT view to keep track of all backup info on a separate table
3. Use a RMAN Catalog on same Database only to this purpose. (not recommended)
See this example: