Lukáš Kroczek
Lukáš Kroczek

Reputation: 91

How to get all executed SQL queries in ORACLE?

Is possible to find out all SQL queries and their return code, which was executed in Oracle database? Specially I want to get all sql queries which has negative sql code (error).

Thank you for answer.

Upvotes: 9

Views: 1724

Answers (3)

Chirag Mehta
Chirag Mehta

Reputation: 11

if you want any solution of error code than please check out Oracle docs for Error message pdf, in which you were find out various error code with its description....

Upvotes: -1

René Nyffenegger
René Nyffenegger

Reputation: 40489

Maybe you can execute your queries within a (anonymous) PL/SQL block, and then use the its exception handler to catch "negative" statements:

begin
  insert into a values (1, 4/0);
exception when others then
  ... error has happened,
  ... use 'sqlerrm' and 'sqlcode' 
  ... for further analysis
end;

Upvotes: 0

Adam Musch
Adam Musch

Reputation: 13583

Everything which was executed? That would require enabling auditing, and fine-grained auditing to boot - and auditing every statement in a database can generate a lot of data.

Upvotes: 2

Related Questions