How to get the SQL_ID that is blocking another SQL?
Locks belong to transactions, not SQL statements.

SQL statements do not block other SQL statements on their own. Transactions may block other transactions.

A transaction may consist of multiple SQL statements.

The database can return the current (v$session.sql_id) and previous (v$session.prev_sql_id) SQL statement for a session.

If the blocking session is idle, its sql_id will be null.

If the lock that blocks another transaction was placed by not the current and not the previous SQL, but by one before them, then you are out of luck, you will not find it in such views.

Even if the lock that blocks another transaction was placed by the current or the previous SQL of the blocking session, there is no direct evidence provided about it. You need to examine the SQLs, you need to know what they do, and using that information, decide if really those SQLs placed the lock that blocks another transaction (session).

A simple query like that may provide adequate results for simple cases, but it can not provide a guaranteed answer to what you asked generally.

You can do that with tracing and carefully reading and analyzing the trace files.