Last SQL run in an OraSession

rmathur

Member²
Is there any way to find out the last SQL string run through a OraSession? I have a bunch of DataSet components, & in case of an exception, I want to find out what the last SQL string was so I can trap it. I want to have only one exception handler in the Application and write the SQL to a log.

Please help!
Thanx,
Raj Mathur
 
The TOracleSession does not have a property or function that returns the last executed SQL. We can add the as an enhancement request if you want.

Maybe there is a system view that contains the last executed SQL statement?

------------------
Marco Kalter
Allround Automations
 
There is an oracle view to see the last executed sql-statement

try this

create or replace view sys.all_sqltext as
select
substr( SID| |','| |SERIAL#, 1, 8) "SESSION_ID"
, substr( lower(USERNAME), 1, 8) "USERNAME"
, lower(OSUSER) "OSUSER"
, lower(TERMINAL) "TERMINAL"
, SQL_TEXT "SQL_TEXT"
, PIECE "PIECE"
from v$sqltext a, v$session b
where username is not null and STATUS != 'KILLED' and ADDRESS =
SQL_ADDRESS and HASH_VALUE = SQL_HASH_VALUE
 
Back
Top