PL/SQL (MOSC)

MOSC Banner

How to Identify the PL/SQL in V$SQL being Executed in Current Session

edited Jun 9, 2009 1:09PM in PL/SQL (MOSC) 4 commentsAnswered
 Hi All

I would like to prepare a stored procedure (named as Log_Error) to perform the error handling for any PL/SQL units in the execution.

It is expected the users to submit or execute the SQL and PL/SQL statements in the folloging format as:

begin

       ..........

exception

      when others then

               Log_Error;

end;

In the design, the procedure, Log_Error, will issue a SQL statement to try to retrieve the PL/SQL source code (as above) from V$SQL and V$SESSION views and then dump the log data onto a separate database table.

In the testing environment, I found that the V$SESSION view can provide two columns of information, i.e. SQL_ID and PREV_SQL_ID.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center