How to Pass APP_USER to a database trigger for auditing

I have a table which is updated by an Apex Page. (Application Express 4.2.1.00.08).
The application is using the standard Oracle apex authentication.
I have created an Audit table with a before update trigger to insert a record into the audit table of who made a change to what column and when.
If I use User in the trigger I get APEX_PUBLIC_USER recorded as who changed the record.
What I actually need is the APP_USER Value e.g KJR recorded. I am not writing the APP_USER to a field in the table so I cannot use : new syntax to capture it from any of the field I am updating.
Can anyone advise how I can pass the APP_USER for the trigger to use?

In PL/SQL code like Trigger you can access the value of item by using v function. Refer the below link
http://docs.oracle.com/cd/E1755601/doc/user.40/e15517/concept.htm#BEICHBBG_
You can use NVL function as well,
:NEW.CREATED_BY := NVL(v('APP_USER'), USER);Thanks,
Lakshmi

Similar Messages

  • How to pass custom search help(F4 help) for a field in ALV output?

    Hi,
    I want to activate the F4 help in ALV output for a field for which we do not have search help assigned at table ,data element and domain level.
    In field catalog i have enabled it by below line.
    ls_fcat-F4AVAILABL = 'X'.
    but because there are no standard input help available it is giving message as "No input help is available".
    so how to pass our custom search help (g_search) for any field in ALV output.
    I am using object oriented ALV grid display.
    Thanks!!!
    Rajesh Gupta.

    hi,
    check this out:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/acdefb13-0701-0010-f1a2-8eeefa7d3780
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d?quicklink=index&overridelayout=true

  • How to create a database trigger for automatic run statspack.snap

    Hi,
    I want to create a database trigger to run statspack.snap at startup.
    connect /as sysdba
    grant create any trigger to perfstat;
    connect perfstat/perfstat
    create or replace trigger auto_snap
    after startup on database
    begin
    statspack.snap;
    end;
    after startup on database
    error at line 2:
    ora-01031: insufficient privileges
    connect /as sysdba
    create or replace trigger perfstat.auto_snap
    after startup on database
    begin
    statspack.snap;
    end;
    Trigger created.
    after shutdown and startup the database, the trigger has not been run. (no statspack snapshot)
    What I have done wrong?

    981145 wrote:
    hi... I have created a database link but it is showing some error. Can you please tell me, do we have to update the details in TNSNAMES.ora file regarding the database which i am creating now before creating database link?????
    awaiting for your response,
    Thanks in advanceI'm sorry, but "showing some error" is NOT an actionable error message. Why do you think we can solve your error if you don't tell us what the error is?
    Yes you will need to adjust your tnsnames. When a process in a database_A accesses database_B via a dblink in database_A, the database_A is acting as a client to database_B. At that point database_A is just like sqlplus or sqldeveloper, and all tns considerations are the same.

  • How can I set up a database program for inputing baseball team statistics that is compatible with numbers?

    I have been asked to be a statistician bar and athletic team. We are playing Dartball, a game of darts that is based on baseball.  The previous status station used Apple works which included a database manager that was compatible with numbers. I have checked with the Apple geniuses online for my MacBook Pro and they did not have an answer to my problem. Is there a program that can be used on my MacBook Pro that will keep up with statistics for eight baseball team?

    Im all for the dumb questions, because its probably a dumb mistake I did.
    I have checked that both sus ped and exp. ped are fully plugged in.
    Neither pedals show up in the Midi meter in the transport.
    I dont know how to set a patch for the keyboard, but if both pedals work in other programs (i.e. Reason), wouldn't it not be an issue with a Logic configuration and not in the keyboard's setting? (Unless I have a separate Logic setting that loads automatically when it detects Logic is booted. I dont know how that would work though.)
    Thank you for your prompt help, though. Any other ideas?

  • Issue in Database trigger for HZ_CUSTOMER_PROFILES PL/SQL: ORA-00936: miss

    Hi
    We are trying to create database trigger on update of table HZ_CUSTOMER_PROFILES when CREDIT_HOLD='Y'
    If this update is done from certain operating unit we are inserting into another custom table when compiling trigger we are getting error as given below
    LINE/COL ERROR
    5/2 PL/SQL: SQL Statement ignored
    17/2 PL/SQL: ORA-00936: missing expression
    SQL> l 5
    5*
    SQL> l 17
    17* COUNTRY,
    Copying code used for creating trigger
    CREATE OR REPLACE TRIGGER "APPS"."SDS_CREDIT_HOLD_ROW"
    BEFORE UPDATE ON HZ_CUSTOMER_PROFILES
    FOR EACH ROW
    WHEN ( new.CREDIT_HOLD='Y')
    BEGIN
    IF FND_PROFILE.VALUE('ORG_ID')=3217 THEN
    INSERT INTO SDS.SDS_CREDIT_HOLD
    (CUSTOMER_NAME,
    CUSTOMER_NUMBER,
    ADDRESS,
    CITY,
    COUNTRY,
    HOLD_BY,
    MAIL_LIST1,
    RESP_VALUE,
    ORG_ID,
    MAIL_LIST2)
    VALUES
    (select rc.customer_name,
    rc.customer_number,
    ra.address1,
    ra.city,
    ra.country,
    fu.user_name,
    fu.email_address,
    TO_NUMBER(FND_GLOBAL.RESP_ID),
    TO_NUMBER(fnd_profile.value('ORG_ID')),
    SDS_EMAIL_ADD_FNC('KAMALAKAR.GUDAPAREDDI,BRIAN.MILLER')
    from HZ_CUSTOMER_PROFILES hcp, ra_site_uses rsa,
    ra_addresses ra, ra_customers rc, fnd_user fu,
    (select distinct site_use_id from HZ_CUST_SITE_USES where site_use_code='BILL_TO'
    and status='A') site_acct
    where hcp.status='A'
    and cust_account_id in (select distinct cust_account_id from HZ_CUSTOMER_PROFILES
    where credit_hold='Y'
    and status='A')
    and hcp.site_use_id=rsa.site_use_id (+)
    and rsa.address_id=ra.address_id (+)
    and rsa.site_use_id= site_acct.site_use_id (+)
    and hcp.cust_Account_id=rc.customer_id
    and hcp.credit_hold='Y'
    and hcp.last_updated_by=fu.user_id
    and hcp.CUST_ACCOUNT_PROFILE_ID=:new.CUST_ACCOUNT_PROFILE_ID
    and hcp.ROWID=:new.ROWID);
    END IF;
    -- commit;
    END SDS_CREDIT_HOLD_ROW;
    tried to search for fix in forums checked all columns in select clause and insert they appear to be fine attaching table structure also for reference
    CREATE TABLE SDS_CREDIT_HOLD
    (CUSTOMER_NAME VARCHAR(50),
    CUSTOMER_NUMBER VARCHAR2(30),
    ADDRESS VARCHAR2(240),
    CITY VARCHAR2(60),
    COUNTRY VARCHAR2(60),
    HOLD_BY VARCHAR2(100),
    MAIL_LIST1 VARCHAR2(240),
    RESP_VALUE NUMBER,
    ORG_ID NUMBER,
    MAIL_LIST2 VARCHAR2(240))
    if any hint for fixing this issue it will be highly appreciated
    Thanks
    Kamalakar.G

    Problem is here:
    WHEN ( new.CREDIT_HOLD='Y')
    Should be using a colon in front of any new or old columns in your PL/SQL and SQL, thus try this:
    WHEN ( :new.CREDIT_HOLD='Y')
    FYI: when using triggers (unless you specify otherwise in the trigger definition itself):
    old values are referenced via :old.column and new values via :new.column

  • How to find if a logical database exists for your program requrements?

    hi
    How do you find if a logical database exists for your program requrements?
    Regards

    You probably know the DB table that you'd like to query
    try where used list : 'Logical database'
    then you can see what interests you...

  • How to pass table data into below code for alv

    hi
    i want to pass table data into alvgrid
    i dont know how to pass table data.
    here instead of passing ABC into internal table
    i want to pass table data .
    please help me
    ialv-test1 = 'ABC'.
    form get_data.
    ialv-test1 = 'ABC'.
    ialv-test2 = 'DEF'.
    append ialv.
    ialv-test1 = 'GHI'.
    ialv-test2 = 'JKL'.
    append ialv.
    ialv-test1 = '123'.
    ialv-test2 = '456'.
    append ialv.
    endform
    thanks in advanced.

    Have a look at below links. It gives you sample code of alv grid.
    http://sap.niraj.tripod.com/id64.html
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    Have a look at below links for SAP Help.
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/e994374c9cd355e10000009b38f8cf/content.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/12/904f42d5f811d2b469006094192fe3/content.htm
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • How to pass parameters to query-database function [Solved]

    Dear All,
    I'm working on a BPEL process which reads a file and the data is passes on
    to a web service. In the transform activity to transform data from the source to the
    web serivice parameters, I want to use the query-database function to check if
    the value given in the file exists in the database. I have added a 'If' XSL construct
    for this. Now when the query is static (given with hardcoded where clause), the
    query-database function works fine. But I want to use one of the column in the
    source variable in the SQL query I'm using in the query-database function.
    i.e. If I give the query as below it is working:
    <xsl:if test="orcl:query-database("select empno from emp
    where empno='10'",.....) > 0">
    I want to replace the hardcoded value 10 with the value from the source variable.
    I'm not sure how this should be done. If I refer to the element directly in the XSL
    it is not working. I've shown this below.
    <xsl:if test="orcl:query-database("select empno from emp
    where empno='/tns:Root-Element/tns:Data/:tns:Empno'",.....) > 0">
    Something like above does not work. I'm not sure also if the syntax is correct. It
    does not give any error, but the transformation does not happen.
    Is there any way you can pass any input value as a parameter to the
    query-database function?
    Thanks in advance
    -Ruban

    Hi Dipal,
    The concat works! Thank you very much for the help. I didn't try concat before.
    I was using a alphanumeric field, so it was required to add one more concat
    for enclosing the value with single quotes. For numerical fields, one concat would
    be enough as you had shown.
    My xsl looks like this now:
    <xsl:if test="orcl:query-database(concat(concat("select empno from emp
    where empno='",/tns:Root-Element/tns:Data/:tns:Empno),"'"),
    false(),false(),"jdbc/DbConnection") > 0">
    This works properly.
    Regards,
    -Ruban

  • How can I change the 'Check-in' trigger for contribution step in Workflow

    We have created a Criteria workflow where the workflow is triggered based on a custom field called 'Publish Status'. During check-in, when a content author sets 'Publish Status' = 'Sent to Review', the content is sent to Reviewer's Workflow Assignments. The client however wants to be able do this from the 'Update Metadata screen' i.e., trigger the workflow and send the document to review from the Update Metadata screen and not just check-in screen.
    The workflow scenario that client wants is as follows:
    - Author checks-in content
    - Author previews content using custom Preview widget from Content Info screen. This is custom code written that gives author the ability to preview their content within the context of the portal where UCM content is rendered.
    - Author is satisfied with their content.
    - Author should just to go 'Update metadata' and set 'Publish Status = Sent to Review' and this should send the content to Reviewers' workflow assignments.
    The problem here is that currently the trigger to send content to Reviewer is only SET by the Check-In screen. How do we change this so it can be triggered directly from the 'Update Metadata' screen and does not require 'Check-in'. The client is right here in that if there is already some checked-in content in UCM that they want to send to review now, why should they have to go to 'Check-out' screen to get to 'Check-in' screen to trigger workflow, why can't they avoid all this and just go to Update Metadata.
    We thought of using Basic Workflow as well, but that does not solve our problem, since once the content ID is selected in the basic workflow, the contribution step still requires user to Check-out/Check-In content. Can anyone suggest a way to send content for review by using 'Update Metadata' screen.

    Hi tanushreem,
    Update triggered workflows are not an uncommon requirement. However, they are a small customization. We have standard and supported components that will do this and would be happy to chat with you more about them. Please let me know.
    Alternatively, it is a fairly straightforward customization if you wanted to build it yourself.
    Warmly,
    Billy Cripe
    Fishbowl Solutions.

  • How to Create a table with numeric trigger for INSERT

    Let me start off by saying that I am very new to DBMS.
    I need to create a Table with INSERT Trigger. I am not exactly sure if I need to have a BEFORE ot AFTER insert trigger but leanning towards AFTER.
    I have a Java code that will need insert a row each time that piece of code is executed. I would also like an oracle trigger to insert a unique numeric value (REC_ID) for that that record.
    I am totally lost and I am not sure how to go about it. Can you point me to the right direction?
    Basically my table will have the following 3 columns
    REC_ID NUMBER NOT NULL (uniquie value inserted by the trigger)
    PROPERTY_NAME VARCHAR2(100 BYTE)
    PROPERTY_VAL VARCHAR2(100 BYTE)
    Thank you in advance
    Eric

    Take a look at the following: Also please do a search in this forum.
    http://infolab.stanford.edu/~ullman/fcdb/oracle/or-jdbc.html

  • How to read data from Logical Database ADA for more than one financia year

    Hi,
    I need to read data from ADA logical database and ANLCV node for current financial year 2007 and for the next 3 years – 2008, 2009, 2010. When I do this using program attached below, I receive only data for one year, which is entered at the selection screen in the field BERDATUM. How should I modify my program to read ANLCV node for more then one year ? Could anybody help me ?
    Kind regards,
    Zbigniew Debowski
    REPORT  ZWRZD075.
    NODES: anlav, anlcv.
    START-OF-SELECTION.
    GET anlav.
    WRITE:/ anlav-anln1, ' ', anlav-anln2.
    GET anlcv.
    WRITE:/ anlcv-kansw, ' ', anlcv-knafa, ' ', anlcv-gjahr.

    Hi!
    Have you already tried your luck in Java Programming forum?
    Regards,
    Thomas

  • How to pass value to some view parameters for a nested combo, on load ? 11g

    Hi, I have a requirement for to do two combos, in a master-detail relationship.
    The first one it's a very simple combo, a simple query in DB, so far so good. The second one depends on first and depends either from the username, that I get from a Payload binding (two parameters in where clause).
    In the first activity on my flow it's work very well. The user chooses the "idMaster", a valueChangeListener event runs an ExecuteWithParams OperationBinding and fills up the nested combo.
    But, I've tried in some many ways to fill both combos and bring in their previously selected values, in the next task, but until now I'm not able to do that. I believe that I have to, somehow, call ExecuteWithParams before setting the defaut value. It's this the correct approach ? I tried it on managed bean constructor, but it not works.
    So, how can I call a VO, passing parameters values into it, fill this nested combo, and set this pre-selected value, before pages load?
    Any ideias?
    Thanks.

    Continue here

  • How to access the Microsoft Dynamics database tables for creating a DW

    Hi all,
    I m trying to build a POC for the manufacturing industry (Dairy Industry).
    Hence I'm trying to install Microsoft Dynamics and access the tables available its OLTP and create a warehouse.
    Please let me know how we access the database tables of Microsoft Dynamics to do etl (using any etl tool).
    Then i would be creating reports and dashboard using OBIEE 11G.
    I thought of getting help before installing microsoft dynamics so that i can install the necessary components to achieve the same.
    Please let me know the necessary things i would need to do.
    Thanks
    Jaan

    Hi,
    I think this can be possible with microsoft ssis etl tool.
    Thanks,
    Navin Kumar Bolla

  • How to create button programmatically and assign trigger for it and add code

    is that possible ?
    How can I create item a button for example programmatically (at run time)
    and create trigger (when-button-pressed) programmatically and write a code
    in the trigger body as well programmatically.
    thankx

    Hello David
    I used the way list and go button which is more safer than creating buttons because
    you can populate the list on fly.
         | dropdown list     \/
              | go button |
    PROCEDURE populate_user_function_list IS
         rg_list_id RECORDGROUP;
         ret_code     NUMBER;
    BEGIN
         rg_list_id := FIND_GROUP('RG_LIST');
         IF NOT ID_NULL(rg_list_id) THEN
              DELETE_GROUP(rg_list_id);
         END IF;
         rg_list_id := CREATE_GROUP_FROM_QUERY('RG_LIST','SELECT FUNCTION_ID, FUNCTION_ID FROM SMS_ROLE_FUNCTION WHERE SMS_ROLE_FUNCTION.DB_ROLE ='||''''||:GLOBAL.USER_ROLE||''''||' ORDER BY SEQUENCE_NO');
         ret_code := POPULATE_GROUP(rg_list_id);
         --Populate record group.
              IF ret_code <> 0 THEN
              bell;
              MESSAGE('Record Group could not be populated');
              RAISE FORM_TRIGGER_FAILURE;
              END IF;
         POPULATE_LIST('DYNAMIC_BLK.USER_FUNCTION','RG_LIST');
         DELETE_GROUP(rg_list_id);
    END;
    --this is the button to go the user selection
    begin
         if :DYNAMIC_BLK.USER_FUNCTION is not null then
              --go to selected form
              call_form(:DYNAMIC_BLK.USER_FUNCTION,NO_HIDE,DO_REPLACE,NO_QUERY_ONLY,NO_SHARE_LIBRARY_DATA);     
         else
              bell;
              message('Please select a function');
         end if;
    end;

  • Help:Oracle 9i Active database trigger for insert

    Pract 4:Active Databases
    Create a table emp1 (eno, ename, hrs, pno, super_no) and
    project (pname, pno, thrs, head_no) where
    thrs is the total hours and is the derived attribute.
    Its value is the sum of the hrs of all employees working
    on that project, eno and pno are primary keys,
    head_no is the foreign key to emp relation.
    Insert 10 tuples and write triggers to do the following
    1) Creating a trigger to insert a new employee tuple and
    display the new total hours from project table.
    2) Creating a trigger to change the hrs of
    existing employee and display the new      total hrs from project table
    3) Creating a trigger to change the project of an employee and
    display the new total hrs from project table
    4) Creating a trigger to deleting the project of an employee
    --using bom1:-
    SQL> connect hr/tiger@bom4;
    Connected.
    SQL> create table Project17
    2 (
    3 pno number(5) primary key,
    4 pname varchar2(25),
    5 thrs number(5),
    6 head_no number(5)
    7 );
    Table created.
    SQL> create table Emp17
    2 (
    3 eno number(5) primary key,
    4 ename varchar2(25),
    5 hrs number(5),
    6 pno number(5),
    7 super_no number(5),
    8 constraint Pno_fk foreign key(pno) references Project17(pno)
    9 );
    Table created.
    --Inserting records into table Emp1
    SQL> insert into Project17 values(1,'IMS',125,1);
    1 row created.
    SQL> insert into Project17 values(2,'CRM',135,1);
    1 row created.
    SQL> insert into Project17 values(3,'P and A Section',145,2);
    1 row created.
    SQL> insert into Project17 values(4,'Rishabh Dighia Steels',225,3);
    1 row created.
    SQL> insert into Project17 values(5,'BPTLibrary',215,4);
    1 row created.
    --Inserting records into table Project
    SQL> insert into Emp17 values(3,'Shubhangi',145,3,28);
    1 row created.
    SQL> insert into Emp17 values(4,'Crima',225,2,98);
    1 row created.
    SQL> insert into Emp17 values(5,'Harshada',215,4,62);
    1 row created.
    SQL> insert into Emp17 values(6,'ashish',215,4,62);
    1 row created.
    SQL> insert into Emp17 values(7,'salil',115,3,92);
    1 row created.
                        Queries:-
    connect hr/tiger@bom4;
    1) Create a trigger to insert a new emp tuple and display the new total hrs
    from project table
    create or replace trigger trigemp_ins
    after insert on Emp17
    for each row
    when(new.pno is not null)
    declare
    vthrs number(9);
    begin
    insert into Project17 values(:new.pno,pname,thrs,head_no);
    Select thrs into vthrs from Project17 where pno=:new.pno and thrs=thrs+:new.hrs;
    dbms_output.put_line('new Total Hrs:'||vthrs);
    end;
    Warning: Trigger created with compilation errors.
    SQL> show errors;
    Errors for TRIGGER TRIGEMP_INS:
    LINE/COL ERROR
    4/2 PL/SQL: SQL Statement ignored
    4/51 PL/SQL: ORA-00984: column not allowed here

    Hi,
    have a look at your insert. It misses some ":new."
    Herald ten Dam
    Superconsult.nl

Maybe you are looking for

  • Goods receipt for import material

    Dear all, The excise tab does not appear during goods receipt of imported material. But when are doing the goods receipt for domestic material the tab does appear. Even after posting goods receipt and while trying to capture excise details in J1IEX i

  • Watching DVDs & other video via PBG412" & HDTV

    Hello. I've been using a PBG412" as a media center for the last 4+ years. I have a remote attached (third party infra-red remote) and it works great! This winter my wife and I are considering a new TV for the first time in, well, a long time. Right n

  • Usage Rights lost - important info

    Hello! Today I updated a test system with a new Reader Extension certificate cause the old one had expired. After installing the new one via adminui I tried to apply usage rights but always got the message by Reader that the document had rights which

  • Can't install itunes 11.0.1 on windows 7...get a Rolling Back Action message

    Hi...I cannot install iTunes 11 on my Windows 7 PC. The installation goes all the way through and I get a "Rolling Back Action" dialog at the end and the progress bar just goes backwards. Why is this happening?

  • Saving photos from iPhoto

    So I can no longer upload any photos to iphoto on my Mac...  I have used all the memory, and want to know if there is an easy way to download my albums to a portable HD?  Similar to how it's done in time machine.  Thanks.