Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save richardpascual/b8674881dac0280f606d to your computer and use it in GitHub Desktop.
Save richardpascual/b8674881dac0280f606d to your computer and use it in GitHub Desktop.
Example of implementation of DBMS_APPLICATION_INFO in Oracle PL/SQL (10g and later)
-- This is an example framework of how to implement tracking of package/procedure/function plsql
-- procedural code execution (Oracle) with a built-in package: DBMS_APPLICATION_INFO; the intent
-- is to set this syntax layout up so that developers can have a flexible, customizable syntax
-- to accomplish this task.
-- Look for my project here on Github, the ORA-EXCEPTION-HANDLER. (richardpascual)
CREATE or REPLACE PROCEDURE PROCESS_TWEET_LOG is
c_client_info constant V$SESSION.CLIENT_INFO%TYPE := 'DEV-DATABASE, OPS408 SCHEMA';
c_module_name constant V$SQLAREA.MODULE_NAME%TYPE := 'PROCESS_TWEET_LOG';
l_action V$SQLAREA.ACTION%TYPE:= null;
BEGIN
DBMS_APPLICATION_INFO.SET_CLIENT_INFO (client_info => c_client_info);
DBMS_APPLICATION_INFO.SET_MODULE ( module_name => c_module_name, action_name => l_action );
-- Initialize Twitterizer
l_action:= 'LoadTweetLog';
DBMS_APPLICATION_INFO.SET_ACTION (action_name => l_action);
... begin Tweet Log Loading Process here.
<more PL/SQL Code here>
-- Count Tweets by seven demographic dimensions
l_action:= 'CountBySeven';
DBMS_APPLICATION_INFO.SET_ACTION (action_name => l_action);
... begin Tweet Log Counting Process here.
<more PL/SQL Code here>
...
EXCEPTION
WHEN OTHERS THEN
err_pkg.handle; -- this is the singular, exception call from the ORA_EXCEPTION_HANDLER project.
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment