How can simple trigger for verification of status update on the table... - I get upd sql then?

Hi guys,.

I need to do a temporary simple audit on all updates on a table.

That's why I create a trigger for her...

However, I need to capture the SQL statement to make the update as well... However I have no way to do it, because it is always replaced by a SQL code I run to get the SESSION ID...

Here is the trigger...
----------------------

create or replace
alert_setting_trg relaxation
before the update on user_alert_settings
for each line
declare
number of v_sid;
v_username varchar2 (100);
v_osuser varchar2 (100);
v_machine varchar2 (100);
v_program varchar2 (100);
v_module varchar2 (100);
v_prevsqlid varchar2 (100);
v_sqltext varchar2 (100);

Start
SELECT SYS_CONTEXT ('USERENV', 'SID')
IN v_sid
FROM DUAL;

SELECT the username, osuser, machine, program, module, PREV_SQL_ID
IN v_username, v_osuser, v_machine, v_program, v_module, v_prevsqlid
SESSION $ v where SID = v_sid;

SELECT sql_text
IN v_sqltext
V $ sqltext
WHERE SQL_ID = v_prevsqlid;

INSERT INTO alert_settings_log
VALUES (sysdate, v_sid, v_username, v_osuser, v_machine, v_program, v_module, v_sqltext,: new.user_id,: new.service_grp,: new.alert_setting_id,: old.alert_active,: new.alert_active);

end;


Now the problem is that...
the capture of SQL statement will always be

SELECT SYS_CONTEXT ('USERENV', 'SID')
IN v_sid
FROM DUAL;


and not the UPDATE table statement.

1st quarter) I have to get the SID of the session before I could know what SQL it is running.

However, once I get the SID, the SQL to UPDATE the SID is run changes the SQL that gets the SID.

What can I do?

Rgds,
Noob

Instead of to the request in three steps, do it in 1. Replace all three of your queries with something like:

SELECT s.username, s.osuser, s.machine, s.program, s.module, q.sql_text
INTO v_username, v_osuser, v_machine, v_program, v_module, v_sqltext
FROM v$session s, v$sql_area q
WHERE s.sid = SYS_CONTEXT('USERENV','SID') and
      s.prev_sql_id = q.sql_id

John

Tags: Database

Similar Questions

  • Configuration of the AUSST. How can I easily check (Mac) computers are updated from the server AUSST?

    I installed everything according to the recipe. Video Karl Gibson watched this probably five times.

    A server

    Users have AdobeUpdate.Overwrites file in place

    Everyone's updates (couldn't than before by themselves).

    How can I easily see that updates are downloaded from the server AUSST instead of directly from Adobe online?

    I found this on my own.

    The answer lies (on mac) in the/Applications/Utilities/Console

    Look in the sidebar to download Adobe

    DML.log

    Hope this helps someone.

    22/06/14 21:32:13:409 | [INFO] |  |  |  |  |  |  | 2867720 | The download file is http://.local:80/Adobe/updates/oobe/aam20/mac/AdobeExtensionManagerCC-7.0/7.2/setup .dmg

  • How can find data in a colum prj_no in all the table of the same schema

    Hi all

    I find the list of tables with data that has prj_no = "Axis_11" for all tables in the same schema.



    Thank you
    Nr

    PNR wrote:
    I find the list of tables with data that has prj_no = "Axis_11" for all tables in the same schema.

    1. find the tables with a column of PRJ_NO name. You can find it in USER_TAB_COLUMNS
    2 write a query to read the data in each table, using the UNION/UNION ALL operators to merge the results for each table

  • How can I remove food characters line of data in the table

    I have a number of recordings contain characters of power line in a particular column. These are visible in the TOAD as a small place like the end character.
    Replacement of teas fileds by TOAD attempt does not work.

    I used the following to identify the fields with line breaks:

    Select * from table where column is not null and
    InStr (Column, Chr (13)) > 0

    Then tried to update using the following:
    Update table set column = replace (column, chr (ascii (13)), ")
    where instr (column, chr (13)) > 0

    Does not work.

    Any ideas anyone?

    Grondin

    use a regular expression to replace all non-printable characters:

    regexp_replace(column_name,'[^[:Print:]]')

  • How can I trigger an onchange for an item never displayed or hidden event

    Hello - I have a question that I don't want not displayed on my page - more information that the user wants or needs; Let's call him B. It must be
    defined by an event onchange of an visible element (A); Then, the change of triggers B on onchange to set another article (visible) - C.

    When B is visible on the page, it all works. If I hidden or conditionally never displayed, it does not. From the looks of
    He, B never gets changed.

    How can I trigger this event onchange (from B to C value) with no visible B?

    Thank you
    Carol

    Carol:

    Exactly how you set the value of B in the 'onchange' for A Manager?
    If you all work when B is not a hidden item, you should be able to define B as a text box, then use the 'visibility' CSS attribute to hide the loading of the page.

    $x('B').style.visibility = "hidden".

    CITY

  • How can I search for emails?

    Title says it all. How can I search for emails containing a word or phrase in a file?

    Global search
    https://support.Mozilla.org/en-us/KB/global-search

    Quick filter toolbar
    https://support.Mozilla.org/en-us/KB/quick-filter-toolbar

  • How can I buy a book on my iPhone and the gift for a grandchild

    How can I buy a book on my iPhone and the gift for a grandchild

    Use the iBooks from iPad/iPhone app.

    1. Select the book you want on the iBook Store send as a gift (Note: recipient must be in the same country)

    2. tap on the Rectangle with an arrow pointing to the top (at the top right or next to the title)

    3. press on the gift icon, enter a few messages and send.

  • How can I apply for if I'm in Dominican Republic for 1 week?

    How can I apply for if I'm in the Dominican Republic for a week and I want to call landlines USA?

    Sadler1 wrote:

    How can I apply for if I'm in the Dominican Republic for a week and I want to call landlines USA?

    Purchase the package "unlimited USA/Canada. With this, you can call landlines and mobile phones anywhere in the United States and the Canada. The Plan costs 2.99 $par month and works from any country, including going to the United States.

    http://www.Skype.com/intl/en-us/prices/pay-monthly/

    TIME ZONE - US EAST. LOCATION - PHILADELPHIA, PA, USA.

    I recommend that you always run the latest version of Skype: Windows & Mac

    If my advice helped to solve your problem, please mark it as a solution to help others.
    Please note that I usually do not respond to unsolicited private Messages. Thank you.

  • Credit card was stolen. How can I pay for storage iCloud with Tunes gift card?

    Credit card was stolen. How can I pay for storage iCloud with Tunes gift card?

    Buy the card normally and wait for it to be loaded.

    (139690)

  • How can I register for the apple care.

    How can I register for the apple care.

    It may already be registered if you bought with the phone. You can check on the following site: https://checkcoverage.apple.com

    If you do not need to register an AppleCare purchase you can do so at https://www.apple.com/support/applecare/register/

  • Hello, my iPhone is blocked because I forgot my password 6-digit phone, how can I reset for it?

    Hello, my iPhone is blocked because I forgot my password 6-digit phone, how can I reset for it?

    See here: https://support.apple.com/en-us/HT204306

  • How can I search for hexadecimal number of 32-bit in .csv file

    Hello

    How can I search for 32-bit in .csv file usinf labview 8.6.1 hexadecimal number

    Mathan,

    This post was not really a solution.  He just ordered Sandy to post in the appropriate forum, which we now know is LabVIEW 8.6.1 LV.

    Sandy,

    You want to read the text file, then use the search/Split String function to find the matching characters that make up your hexagonal pattern.

    What you ask is a little strange wordly since .csv files are text files, and you ask a "32-bit hexadecimal number.  Can you give an example of what you are looking for?  My response assumes you have a 8 string that consists of the characters 0-9, A - F for catch the 4 bytes.  Maybe you are dealing with just 4 bytes that present themselves as ASCII characters in a text file.  In which case you wouldn't have one. CSV file.

    If the response of research/Split String is not useful to you, you will need to provide details about what you are looking for and also an example of your. CSV file.

  • How can I search for all photos that have names composed of four numbers?

    OT: Help search.

    Hello, I want to seek a photo (.jpg), photography is as the name of 5225.jpg, which consists of four digits. How can I search for all photos that have names composed of four numbers? Thank you

    I don't know how to search only images that carry the 4 numbers, but I know how to find a file that is exactly 4 letters long and ends with ".jpg".

    To do this, type this in your search box (exactly as it is, including quotation marks):

    "file name:"? "jpg"

    It will search for all files that have exactly 4 characters followed by .jpg at the end.

  • How can I know for sure if this is call microsoft?

    How can I know for sure if it's microsoft appeal is there a specific question I can ask? Once again thank you.

    I never ever ever heard the call of a client of Microsoft.  There are millions of customers, why they call any particular customer.  Actually how they know it a phone number.

  • How can I search for a word in several files in a particular folder?

    Original title: search for a specific word

    Hello

    I'm working on Windows 8. How can I search for a word in several files in a particular folder?

    TKS

    Provide the location is indexed, you can search for a specific phrase or Word file Explorer by typing content: follow-up of your phrase surrounded by quotation marks. This will produce a list of files, the filtering criterion.

Maybe you are looking for

  • Latest version of Firefox does not work on Win 7 64 bit

    Downloaded the latest version of Firefox and installed on my newly built computer Win 7 64 bit. When I click on the shortcut of Firefox, it absolutely nothing happens. No processes appear in the Task Manager, nothing. Googled the question and I tried

  • Advice on which necessary to a Satellite P200-1JV driver

    Hello I have a Satellite P200-1jv (PSPB6E) and miss a driver after a format for a mass storage controller. If someone can advise which driver should I install? THX vinnygreg

  • "Region error" on Tecra 750DVD

    I reinstalled my Tecra 750DVD (new HARD drive) on the recovery CD.I can play region 0 DVD ok and some region 2 ones (freebies of newspapers).I get "Error region" play some region 2 discs - those sold commercially.How can I "say" the machine that I am

  • Account of WebOS

    How does WebOS account? If I was to give my TouchPad to factory settings and new journal in it with my account WebOS, applications I bought would appear back? Also, if I re - it is preferable to full erase rather than the secure full erase because I

  • Dell XPS One 2710 Fresh install

    I want to do a new install of the operating system with a new SSD, I intend to buy my 3 years old Dell XPS One 2710. It is my understanding that the Windows operating system authorization key is integrated into the motherboard. I think it is in the B