Query to get uncommitted statements in the current session

Query to get uncommitted statements(INSERT, UPDATE or DELETE statements) in the current session:

SQL> SELECT COUNT(*)
FROM v$transaction t, v$session s, v$mystat m
WHERE t.ses_addr = s.saddr
AND s.sid = m.sid

AND ROWNUM = 1;
 
COUNT(*)

———-
0

 

IF: count>0

SQL> SELECT COUNT(*)
FROM v$transaction t, v$session s, v$mystat m
WHERE t.ses_addr = s.saddr
AND s.sid = m.sid
AND ROWNUM = 1;

COUNT(*)
———-
1
 
i.e. You have uncommited statement…do either commit or rollback as appropriate.
You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply