How to track column level value change in oracle using procedures

I would need to write the below code using oracle stored procedures & packages.
DBA hates triggers so i cant enforce the same code.
Please help me out to achieve the same. thanks in advance.
if i do DML on master table (emp) , the audit should go to the emp_audit.i have used triggers but oracle DBA dont want to use triggers. Please guide me.
Master table : emp
column 1 : emp_id
column 2 : salary
create or replace TRIGGER test
AFTER INSERT OR UPDATE OR DELETE ON emp
FOR EACH ROW
BEGIN
IF INSERTING THEN
INSERT INTO emp_audit
(emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
VALUES (
:NEW.emp_id,
:NEW.salary,
:NEW.CREATED_TS,
:NEW.CREATED_user,
:NEW.MODIFIED_TS,
:NEW.MODIFIED_usER,
systimestamp, 'C'); -- INSERT
ELSIF UPDATING THEN
INSERT INTO emp_audit
(emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
VALUES (
:OLD.emp_id,
:OLD.salary,
:OLD.CREATED_TS,
:OLD.CREATED_user,
:OLD.MODIFIED_TS,
:OLD.MODIFIED_usER,
systimestamp, 'U'); -- UPDATE
ELSIF DELETING THEN
INSERT INTO emp_audit
(emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
VALUES (
:OLD.emp_id,
:OLD.salary,
:OLD.CREATED_TS,
:OLD.CREATED_user,
:OLD.MODIFIED_TS,
:OLD.MODIFIED_usER,
systimestamp, 'D'); -- DELETE
END IF;
END;
thanks,
bala

i am sorry.
we can't change master table emp structure.
Audit table would be emp_audit.
Please guide me to write some generic procedure to handle the audit , what ever insert/update/delete.
Please do the needful. thanks in advance.
Master table : emp
column 1 : emp_id
column 2 : salary
Audit Table : emp_audit
columns:
emp_id ,
salary,
created_ts,
CREATED_user,
MODIFIED_TS,
MODIFIED_usER,
archived_ts,
event_cd
create or replace TRIGGER test
AFTER INSERT OR UPDATE OR DELETE ON emp
FOR EACH ROW
BEGIN
IF INSERTING THEN
INSERT INTO emp_audit
(emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
VALUES (
:NEW.emp_id,
:NEW.salary,
:NEW.CREATED_TS,
:NEW.CREATED_user,
:NEW.MODIFIED_TS,
:NEW.MODIFIED_usER,
systimestamp, 'C'); -- INSERT
ELSIF UPDATING THEN
INSERT INTO emp_audit
(emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
VALUES (
:OLD.emp_id,
:OLD.salary,
:OLD.CREATED_TS,
:OLD.CREATED_user,
:OLD.MODIFIED_TS,
:OLD.MODIFIED_usER,
systimestamp, 'U'); -- UPDATE
ELSIF DELETING THEN
INSERT INTO emp_audit
(emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
VALUES (
:OLD.emp_id,
:OLD.salary,
:OLD.CREATED_TS,
:OLD.CREATED_user,
:OLD.MODIFIED_TS,
:OLD.MODIFIED_usER,
systimestamp, 'D'); -- DELETE
END IF;
END;
thanks,
bala

Similar Messages

  • How in ColdFusion with in variables get a Oracle stored procedure to return values?

    How in ColdFusion with in variables get a Oracle stored procedure to return values?
    We have tried several things, we can get  a stored procedure to return a result set if we are not passing in variables but we cannot get them when we are passing in variables.
    We know how to do it calling  MS SQL.
    Thanks for any help,
    Nathan Sr
    P.S. we have heard this may not be possible with the current Oracle Driver is there a different Oracle driver?

    I can only barely understand what you're asking here (not from a technical perspective, but from understanding your written English), but I suspect you're wanting to know how to pass back values other than recordsets from Oracle?
    You should be able to pass them back via a type=out proc param, shouldn't you?
    If you could reword your post so it's a bit more coherent, and possibly post some code, that might help.
    Adam

  • How To Track Audio Level by Keyframe Numerically

    Hi,
    I want to change the track volume from time A to time B by submitting numeric values for track volume at time A and B, and let Premiere alter the track volume accordingly when playing back. Basically, how do I update the value of the keyframe numerically ? How is this done ?
    When I place the time cursor in timeline and adjust the track volume in audio mixer and then hit the add-keyframe rhomb at the track head, then it creates a new keyframe, but not with the value of the track volume in the audio-mixer. Unless it was the very first keyframe i've created.
    I do not want to alter volume keyframes by dragging, that is not working precise enough to even come close to the targeted volume setting.
    I also do not want to record live track-slider changes in the Audio-Mixer.
    At http://help.adobe.com/en_US/premierepro/cs/using/WS1c9bc5c2e465a58a91cf0b1038518aef7-7f35a .html i saw "Adjust track volume with keyframes", but wasn't able to find any " ... Track > Volume from the drop-down menu at the head of the clip in the audio track", seems that corresponds to clip volume again and not to track volume.

    Well, you may not be happy with my answer, but it is the only way I know of to enter the level by typing a number.
    If you set the Track Mixer for that particular track to "Write" and enter the number you want, let's say -6 dB, then you press the play button on the timeline, when you stop the playback, the keyframes will have been set to that level. You can left and right arrow to get the job done also.
    You may find that you will want to move the keyframes around after doing that, and you have to be careful not to overwrite the other keyframes, but it does work.

  • How to track planning book keyfigure changes?

    Hi,
    If theere are any changes in the planning book keyfigure how do we track who has made it ?
    How do we see at keyfigure level data change and user who  chnaged?
    thanks,
    shan
    P.S:rewards guranteed

    these two links might help
    Re: APO DP macro to handle column data
    Re: SAP SCM APO DP - Planning Book
    you can create macros dorectly in production if u need it urgently. but if you transport a book from dev later it will overwrite what you have made

  • OO ALV - How to highlight cell after value change

    Hi All,
    I have an OO ALV with an input enable column and would like to highlight a cell in a different color when the user changes it's value.
    I am using pr_data_changed->get_cell_value to check the cells value has changed and pr_data_changed->modify_cell to update the cell with the new value.
    The output table has a field called CELLCOLOR of type LVC_T_SCOL which I am using to highlight the cell in red:
             lw_cellcolor-fname = 'THISFIELD' .
             lw_cellcolor-color-col = '7'.
    The ALV layout is also correclty set using:   layout-ctab_fname = 'CELLCOLOR'
    All the above is working fine and the changed cell is highlighted HOWEVER it only works if I call METHOD g_grid->refresh_table_display
    Is there anyway to highlight the cell without calling method refresh_table_display??????
    I do not like to call method refresh_table_display in an ALV event. The main reason is if a user changes a cells value and at the same time selects the row for update then the method refresh_table_display wipes out the row selection marker.
    So Is there anyway to highlight the cell without calling method refresh_table_display??????
    All your help appreciated
    Che

    Try this way
    In the PAI use
    call method get_selected_rows
    This will get you the row index of the selected rows from the screen for example I_ROW
    In PBO
    call method g_grid->set_selected_rows
    exporting
      it_row_no = i_rows[].
    then call refresh_table_first_display
    So this one will keep row selection after the refresh_table_first_display method

  • How to write rfc when value change in the screen (browser) in webdynpro.

    Hi,
    I want to know how can i write an RFC when screen value change in webdynpro. I already designed a rfc where all the value can be seen in the webdypro screen. Now when user change the value how can i pick the changed value in R/3 so that i can save it into the respective database.  Please send some code for understanding it easily as i am new to this field.
    Regards
    Deep

    Hi Deepak,
    Though I dint understand your requirment properly but as it is raised in Web Dynpro forum I considering that you want to send the data filled by the user to your backend using RFC calls. For this purpose you can refer to this two documents available on SDN.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/creating%20a%20web%20dynpro%20application%20accessing%20abap%20functions.pdf">Tutorial 4</a>
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d352a790-0201-0010-5082-b1a608d22b6c">Tutorial 5</a>
    Regards
    Sid

  • How get one column's value in dashboard of obiee?

    I have two reports, MAIN report and DETAIL report. I want to get one column's value as the filter of DETAIL report.
    For example, the MAIN report is
    Class AVG_Age MAX_Age MIN_Age
    Class1 13 15 11
    Class2 14 16 12
    DETAIL report is
    Name Class Old Describe
    Name1 Class1 15 ...
    Name2 Class2 16 ...
    Through the Navigation to implement it, when I click the 15 of MAIN report, it can only show the MAX age student of calss1. So I have to put the MAX_Age as the DETAIL report's filter. How can I get it?
    Thanks
    Edited by: user10496160 on 2008-11-3 下午9:31
    Edited by: user10496160 on 2008-11-3 下午10:53

    If I understand correctly, what you are trying to do is build a report so that a user can determine the oldest student of a particular class and then look at the details of that student, yes? But what if several classes have a student (or students!) with the same "max" age? For example, what if there are students in 2 classes that are aged 15 and are the oldest in their respective class? Wouldn't you want to give the user the option if choosing the various classes in which the oldest student is the "max" age? Then do this:
    On the Main report, put the summary information as you have it (Class, AVG_Age, MAX_Age, MIN_Age). Put the Value Interaction navigation on the MAX_Age column.
    On the Detail report, put Class, Name, Age, Description, etc., and any other columns that show the details of the student(s) that are the oldest. Add the filter on the Age column: "Is prompted." Now, create a Pivot Table view and place the Class column in the Pages area. (If you want you can create a duplicate of the Class column so you can have a copy in the Rows section of the Pivot Table.)
    Now when the user clicks on the MAX_Age in the Main report, it will show the Detail report with the Classes that have students with the same "max" age in a drop down window. The user can select different classes to see the various students that meet that criterion.

  • How to track Service Order Status Change (IW31/IW32).

    I have a requirement to send the customer an Email if the status of service order has been changed say from unconfirmed to confirmed. So i have to find out whether the status of the service order has been changed on the current date.
    As per my understanding, Changes corresponding to any object are stored in tables CDHDR and CDPOS if the change document creation is enabled for that object. But in case of service order status, the changes are not being captured in these tables because change document creation is not enabled for the data element (J_STONR) of service order status.
    Anyone having any knowledge about it please help me.
    Edited by: Gagan Garg on Feb 23, 2009 6:52 AM

    Hi,
    Thanks for your reply. I have found out the way to track the service order changes. Function module STATUS_READ_MULTI can be used for the same. Pass service order number in OBJNR_TAB and the change document for status is returned in JCDS_TAB

  • How to get column default value define on table?

    Hi,
    I am trying to get a table column default value with no success. I am using the Oracle Data Provider for .NET 10g Release 2 (10.2.0.2)
    1). OracleConnection.GetSchema( "Columns", New System.String() {"<Owner>", "<Table_Name>"} returns everything BUT default value.
    2). I tried querying oracle directly (sample below) but the default value comes back blank even though the column has one defined.
    Dim oracleConnection As Oracle.DataAccess.Client.OracleConnection = factory.CreateConnection
    Dim oracleCommand As New Oracle.DataAccess.Client.OracleCommand( _
    "SELECT data_default FROM DBA_TAB_COLUMNS WHERE OWNER = 'TEST_SCHEMA' AND UPPER( TABLE_NAME ) = 'TEST' AND UPPER(COLUMN_NAM) = 'TESTCOL'")
    oracleConnection.Open()
    oracleCommand.Connection = oracleConnection
    Dim oracleReader As Oracle.DataAccess.Client.OracleDataReader = oracleCommand.ExecuteReader
    oracleReader.GetValue(0) 'This will return blank rather than default value for the column.
    oracleReader.Read()
    oracleReader.Close()
    oracleConnection.Close()
    Any help would be appreciated.
    Thanks,
    Rob Panosh
    Advanced Software Designs

    Hi Rob,
    I just ran up a quick test and I can't duplicate the behavior you describe.
    I created a simple table as "scott":
    SQL> create table def_test(c varchar2(32) default 'hello, world');
    Table created.In my simple test I used the following C# code:
    NOTE: There is an error in this code if using ODP.NET (see my post below for details on this)
    using System;
    using System.Data;
    using System.Data.OracleClient;
    class Program
      static void Main(string[] args)
        string constr = "user id=scott;" +
                        "password=tiger;" +
                        "data source=orademo;" +
                        "pooling=false;" +
                        "enlist=false";
        OracleConnection con = new OracleConnection(constr);
        con.Open();
        OracleCommand cmd = con.CreateCommand();
        cmd.CommandText = "select   data_default " +
                          "from     all_tab_columns " +
                          "where    owner='SCOTT' " +
                          "and      table_name='DEF_TEST' " +
                          "and      column_name='C'";
        OracleDataReader dr = cmd.ExecuteReader();
        dr.Read();
        string defaultValue = (string) dr.GetValue(0);
        Console.WriteLine("Default value is: {0}", defaultValue);
        dr.Dispose();
        cmd.Dispose();
        con.Dispose();
    }Since the GetValue method returns an "object" I cast the value to a string and got the correct result.
    However, I don't have a 10.2 ODP.NET environment right now so I was using 11.1 for this.
    In your real code I suspect that you assign "oracleReader.GetValue(0)" to something - when you say "blank" do you mean zero length or a space or something else?
    Regards,
    Mark
    Edited by: Mark Williams on Jul 31, 2009 10:02 AM

  • Unable to reset the variable value in the method value change event and use

    Hi ,
    int i=4;
    public changevalue(ValueChangeEvent ValueChangeEvent)
    //some code
    i=5;
    system.out.println("in changevalue method="+i)// this prints i value as 5
    public void submit(ActionEvnet actionEvent){
    //somecode
    system.out.println("in submit="+i) // this prints value 4;though its value is changed as 5 in above mehtod
    how can i get the value as i=5 in second method(i.e, in submit method)??

    Hi 980230,
    When I tried the same thing it gives me 5 in the submit method.
    Are you sure that ValueChange method is getting invoked before the actionEvent method?
    Its better to debug the application, you will get the exact flow and error if any....
    Thanks
    --NavinK                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Q : Using column level VPD policies with Oracle Jdeveloper ADF BC ?

    For one of our big customer, we already successfully developped a new java application using Oracle Jdeveloper with ADF, ADF BC and the Virtual Private Database (VPD) with row level policies.
    Our customer has new business requirements that could be fullfilled using column level VPD policies.
    Has someone already successfully (or not) developped a business application using column level VPD policies with ADF, ADF BC on Oracle 10g R2 database and OracleAS 10g (10.1.2) ?
    Is it supported by Oracle ? what are the pitfalls, difficulties, problems you've met ?
    Is it a viable solution and if not, why ?
    Thanks in advance.
    Rémy

    Tomas,
    my 2 cent:
    if you know how to get the info from the db during run time you should be able to overwrite the frameworks message bundle look to get the description from the db instead of from the resource bundle.
    Or you load all descriptions from the db into a resource bundle and use the keys in the tooltip directly.
    Timo

  • How to trap null return values from getters when using Method.invoke()?

    Hi,
    I am using Method.invoke() to access getters in an Object. I need to know which getters return a value and which return null. However, irrespective of the actual return value, I am always getting non-null return value when using Method.invoke().
    Unfortunately, the API documentation of Method.invoke() does not specify how it treats null return values.
    Can someone help?
    Thanks

    What do you get as a result?I think I know what the problem is.
    I tested this using following and it worked fine:
    public class TestMethodInvoke {
    public String getName() {
    return null;
    public static void main(String args[]) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    Object o = new TestMethodInvoke();
    Class cls = o.getClass();
    Method m = cls.getMethod("getName", (Class[]) null);
    Object result = m.invoke(o, (Object[])null);
    if (result == null) {
    System.err.println("OK: Return value was null as expected");
    else {
    System.err.println("FAILED: Return value was NOT null as expected");
    However, when I use the same technique with an EJB 3.0 Entity class, the null return value is not returned. Instead, I get a String() object. Clearly, the problem is the the EJB 3.0 implementation (Glassfish/Toplink) which is manipulating the getters.
    Regards
    Dibyendu

  • How do i allow users to change their oracle password?

    Please help.
    I need a procedure/module in my forms6 to allow users change their oracle database passwords. I am using Oracle 8.0.6.
    thanks for a reply

    SEND YOUR EMAIL SO I CAN SEND YOU A COMPLETE
    FORM HOW TO CHANGE THE USER PASSWORD
    MARK

  • How to get selected row values in a table using check box

    Hi ADF Experts,
    JDEV Version 11.1.1.7.0
    My requirement is getting the selected row valuesof a af:table using a checkbox(multi select).
    Thanks,
    Animesh

    Hi,
    add a transient attribute to the POJO entity and update this through a check box. The ensure you have autosubmit=true set on the check box. In a value change listener set or remove the row's checbox attribute value
    Frank

  • How to set a default value in my DropDown using the key  ?

    Hello All,
      Can someone advose how I can achieve the above ? I will like to know how to select a default value for the dropdown by key using the key value instead of description.
      The reason why I need to do so instead o fusing description is because my application will populate the dropdown using web services based on the language selection. Hence, if I were to set the default value using description, den other languages will not work anymore.
      Any help will be greatly appreciated. Thank you !!
    from
    KWok Wei

    Kwok,
    Assuming that:
    1. You have a node NodeX, where attribute TargetAttr defined
    2. You have a DropDownByKey UI control, its property selectedKey bound to NodeX.TargetAttr attribute
    Then:
    Place in your code:
    wdContext.currentNodeXElement().setTargetAttr("yourKey");
    VS
    P.S. This topic was raised several times, and forum search works good enough to find an answer

Maybe you are looking for