sql-error-secondary-error-id returns the secondary error identifier. On ODBC this is the error code from the underlying database. On Oracle that is the "v4 return code" (also known as "return code") in the Cursor Data Area, which is the useful code.
ODBC drivers for Oracle return the "v4 return code" as the underlying database code. Therefore in the event of an error on connection to an Oracle database,
sql-error-secondary-error-id always returns the "v4 return code" whether the connection is through ODBC.
LispWorks User Guide and Reference Manual - 20 Sep 2017