<div dir="ltr"><div dir="ltr"><div dir="ltr">If you are a Snowflake fan then you are familiar with query_history. query_history in Snowflake tracks all SQL statements issued and any errors. Now this is available in Oracle 23ai in the v$sql_history view:<br><br>SELECT<br> SQL_TEXT<br> , ERROR_FACILITY<br> , ERROR_NUMBER<br> , ERROR_SIGNALLED<br> , SQL_EXEC_START<br>FROM v$sql_history<br>order by SQL_EXEC_START desc;<br><br><br>"SQL_TEXT" "ERROR_FACILITY" "ERROR_NUMBER" "ERROR_SIGNALLED" "SQL_EXEC_START" <br>"with order..." "ORA" "903" "Y" "" <br>"with order..." "ORA" "903" "Y" "" <br>"with order..." "" "0" "N" "16-07-2025 05:13:15" <br><br>To be able to query the sql_history in Oracle you will first need to enable it:<br><div>alter system set sql_history_enabled=true scope=both; -- log out and log back in after this.</div><div><br></div><div>One thing to note is that the SQL_EXEC_START is always NULL when the query errors out. Not sure if that is a bug in Oracle 23ai.</div><div><br></div><div><br></div><div><br></div><br></div>
</div>
</div>