Check which column in database table is updated without hard code

Hi ,
I have a requirement to detect if there is a particular column in the database table is updated , and this column name is found in mapping table ( business logic ) , it will do an insertion to another special table.
My idea is to introduce a trigger before update or delete on this table
However , i would like to make it as dynamic as possible
i dont want to use things as below in trigger if possible
1. if ( old.name <> new.name ) then {
if( 'name' is inside the mapping table ) {
// do some insertion
I want things like
2. if ( there is a column updated on this table ){
1. select column name and updated value that is updated
2. if the column name that is updated is inside the mapping table {
// do some insertion
I am not really sure if the pseudo code listed in no 2 is achieveable in oracle using simple pl/sql or sql ?
if possible , how to do it ?
Thanks

Hi,
Check the link given below
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm
and search for
IF UPDATING THEN*009*

Similar Messages

  • Dynamic creation of column in database table

    Can I create columns in a database table dynamically?
    Let's say I have two columns in a table. Users requested to have dynamic columns in the table. They wanted to create any no. of fields in the table dynamically. We can't alter the table every now and then. Is there any solution for this. Please let me.
    Your early response is highly appreciated.
    Thanks

    I can't use "Alter" statement every time. User may need to insert any no.of columns dynamically. There is no fixed columns. Right now there are two columns which are static. Somebody said it is durable through XML. Can you please let me know in detail. I haven't not done anything using XML.
    Thanks for the response.

  • How to check which fields of a table are changed

    Hi
    I have a FM in which i pass VBAK and VBAP. I store records of table in internal tables and update the values during execution and at the end of this i have to cpmare VBAK and VBAP with internal tables to chcek which field value is changed in both VBAK and VBAP. Its not possible to check all fields bcause there are so many fields in VBAK and VBAP. Can any body help me.
    Thanks and Regards
    Aditya

    Hi,
    Try using where used list.
    click on the field. pree F1. select Technical Info from the pop-up. then from the field data, double click one the field name. it will navigate to the table/structure where the field is used. double click on the field there or
    press CntrlShiftF3.
    It will give you the where used list.
    Pls reward poins if useful.
    Regards,
    Chandru

  • Change Date Column in database table format from mm/dd/yyyy to dd/mm/yyyy

    Hi I use Jdeveloper 11G with an Oracle Database.
    My table is empty currently but I am importing some excel columns into it and the dates in them are throwing errors because you have some dates like 14/09/2012 which would mean the month is out of range even though its not.
    This seems like a simple thing to do but I was unable to find how online.
    Please Help

    I'm not sure I understand COlumn Type is DATE
    There is no Simple Date type. This is DATABASE, has nothing to do with Entities and Views etc. This is straigh in the Database Table.
    Edited by: Dino2dy on Nov 6, 2012 5:47 AM

  • How to map single input value to Two columns of Database table using format file of Bulk Copy Process

    Hi All,
    Am using OPENROWSET to load the file data into table, here the problem is i need to map same input value to two different columns of table, As format file doesn't allow the duplicate numbers am unable to insert same value to two columns, please help me to
    find a solution for this. 
    i can use only OPENROWSET because i need to insert some default values also which come based on file. only the problem is how to map same input value to two different columns of table. please give me the suggestions.
    Thanks,
    Sudhakar

    From what you say:
       INSERT tbl(col1, col2)
          SELECT col1, col1
          FROM   OPENROWSET(....)
    But I guess it is more difficult. You need to give more details. What sort of data source do you have? What does your query look like? The target table?
    Erland Sommarskog, SQL Server MVP, [email protected]
    Hi Erland,
    Thanks for your response
    my source file is text file with | symbol separate for ex:
    1002|eTab |V101|eTablet|V100|Logic|LT-7|Laptops|SCM
    Database table have columns like
    column1,column2,column3...etc, now i need to insert same value from input file into two columns for ex:
    the eTab value from text file has to be insert into column2 and column3 of
    table
    we cannot change format file like below one
    for the above situation how can we insert eTab into column2 and column3
    Thanks,
    Sudhakar.

  • Database table wrongly update

    Hi team,
    I have one big production database; under this production database one very important table is there.
    Here I am updated the table wrongly, but I have table backup before updating  the table.
    Here how we can restore the backup table into old backup table.

    In your case, Its better to use the same condition to update the value from backup tables by joining the columns on a key combination.
    update T1
    set T1.<column1>=T2.<column1>,
    T1.<Column2>=T2.<Column2>
    FROM <TableName> T1 INNER JOIN <Table_Backup> T2 on T1.id=T2.id
    Where t1.id between 100 and 1000
    OR
    If there are no inserts/updates/deletes happen after the change, then you can try dropping the original table and rename the backup table by re-creating all the metadata
    -Prashanth

  • Database table not updating

    Hi all,
    I am updating the database table with following syntex, but table not updating.
    MODIFY ZTEST_BAR FROM TABLE I_ZTESTBAR.
    Please help.
    PKB

    Hi,
    firstly you can define internal table and work area as below:-
    internal tables
    DATA : I_ZTESTBAR TYPE TABLE OF ZTEST_BAR.
    work areas
    DATA : I_ZTESTBAR_LINE LIKE LINE OF I_ZTESTBAR .
    here internal table having the same structure as that of ztable which include MANDT.
    Then to update field, you can use add following code:-
    *Update Ztable
    INSERT INTO ZTEST_BAR VALUES I_ZTESTBAR_LINE.
    COMMIT WORK.
    Hope this works for you.
    Thanks..........

  • How to insert message style text columns in database tables

    Hi All,
    i have two pages.
    in first page segment1 lov is their.once u select the segment1 and click on the create button its navigate to next page.
    and display the releted segment1 details(these columns are message text input fields but read only columns).
    plz help me those columns are insert into database tables.
    its very urgent
    Thanks
    Latha.

    Hi Anil,
    plz help me still i am faceing the problem
    so plz help me because i dont know java.
    i wrote below code and i got the below error.
    if(pageContext.getParameter("Submit")!=null)
    String projnumber=pageContext.getParameter("ProjectNO");
    //String projectnumber=pageContext.getParameter("Projectnumber");
    String oldoperationid=pageContext.getParameter("EmployeeNumber");
    String newManagerName=pageContext.getParameter("NewManagerName");
    String ProjectID=pageContext.getParameter("ProjectID");
    String OldOperationName=pageContext.getParameter("OperationsManager");
    String OldOperationID=pageContext.getParameter("OldOperationID");
    OAMessageTextInputBean projnumberbean =webBean.findIndexedChildRecursive("ProjectNO");
    String projnumber=null;
    if(bean!=null)
    projnumber = (String)projnumberbean.getValue(pageContext);
    Serializable[] params = {projnumber,oldoperationid,newManagerName,ProjectID,OldOperationName,OldOperationID};
    am.invokeMethod("xxinsertpagelogic",params);
    and i wrote import also.
    import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
    my errors are
    Error(64,78): incompatible types; found: oracle.apps.fnd.framework.webui.beans.OAWebBean, required: oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean
    Error(65,13): duplicate definition of variable projnumber in method processFormRequest(oracle.apps.fnd.framework.webui.OAPageContext, oracle.apps.fnd.framework.webui.beans.OAWebBean)
    Error(66,9): variable bean not found in class wnsgs.oracle.apps.pa.projectinfo.webui.ProjectInfoCreateCO
    plz help me.
    its very urgent
    Thanks
    Edited by: Latha on Jan 4, 2012 9:57 PM
    Edited by: Latha on Jan 4, 2012 10:00 PM

  • NULL COLUMN ON DATABASE TABLE

    HELLO AGAIN TO EVERYONE AND TO EVERY ONE WHO IS BEEN REPLYING MY MESSAGES,
    I AM STIL HAVING PROBLE WITH MY JSP AND FORM(HTML).
    THE PROBLEM IS , THE NAMECOLUMN OF MY DATABASE REMAINS NULL WHEN I QUERY IT AFTER ENTERING DATA THROUGH THE FORM.COLUMN TYPE IS A VARCHAR . THE DATA ENTERED IS BEEN ENTEREDTHROUG THE request.getParameter() method OF THE JSP I DONT SEEM TO FIND ANY ERROR WITH MY CODE.
    THE CODE ARE PROVIDED BELOW.CAN ANYONE TELL ME WHAT IS HAPPENING BEHIND THE SCENE ON THE NAME COLUMN .I AM NEW TO JSP.
    jsp code
    try{
    Class.forName("com.mysql.jdbc.Driver");
    conn= DriverManager.getConnection("jdbc:mysql://localhost/school","barth","barth");
    // stat = conn.createStatement();
    // String name1 = request.getParameter( "name ");
    //int idnum = Integer.parseInt( request.getParameter("id") );
    //int age2 = Integer.parseInt( request.getParameter("age") );
    PreparedStatement stat = conn.prepareStatement(" INSERT INTO student " +
    " VALUES( ?, ? ,?)");
    stat.setInt(1,Integer.parseInt( request.getParameter("id") ));
    stat.setString(2, request.getParameter( "name "));
    stat.setInt(3,Integer.parseInt( request.getParameter("age") ));
    stat.executeUpdate();
    conn.close();
    catch(Exception e)
    {e.printStackTrace();}
    sample of database table column.
    *******************************************************************************mysql> select * from student;
    | id | name | age |
    | 10 | NULL | 76 |
    | 10 | NULL | 76 |
    | 9 | NULL | 34 |
    | 11 | NULL | 45 |
    | 12 | NULL | 23 |
    14 rows in set (0.13 sec)
    mysql>

    First of all, don't use all CAPS when typing, it gets difficult to follow your text! Also try putting your code in [ code ] -tags in the future, it's so much easier to follow code that way.
    Looking at your database it appears as if name isn't holding a value when you use it in your database call.
    Verify that it *IS holding a value, you can do that by printing it to the console, i.e.
    System.out.println( request.getParameter("name")  );

  • Add entries to database tables using update function module

    Hi All,
    I have a small requirement, in which I need to update Z-tables usimg update function module in update task. In the calling program, I have gathered the data in a field symbol value of type any. I need to pass the same to that function module to update the data which is in the field symbol.
    Please guide me how to achieve this technically.
    Thanks in advance,
    Pradipta .

    Hi,
    I believe you already have evrything with you.....Start Coding the same and come back with any Coding issue.
    I believe you will not be able to pass the Field Symbol in FM Interface.....You need to pass the Variable which Field Symbol is referring....

  • File to rfc...database tables not updated ??

    Hi XI Friends..
    in my File to BAPI..
    it is successfully executed..and it is showing chequered glag in sxmb_moni..and also in runtime workbench it is showing success..but the database tables are not updating..
    i gone thru the link.. reciver rfc adapter..
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/e80440a832e369e10000000a155106/frameset.htm
    now i am working on SP 17.
    so how can i set the values in ...
    <i>Commit Control for Individual BAPI Calls</i>and
    <i>BAPI Advanced Mode.
    In the Successful RETURN-TYPE Values table, what values i have to enter that should lead to a successful execution</i>
    its Asyncronous call..
    in standard BAPI ther is no commit.
    please tell me ..what values in need to give to update database tables..instead of RFC wrapper..
    regards
    ram

    Hi Friends..
    i created ZRFC and in that rfc i given standard bapi and commit work..
    i tested in sap ..the table is updating..
    thru XI..the table is not updating...
    it showing likw this..in receiver rfc adpater monitering...
    <i>Receiver channel 'CC_IN_SAP_WorkOrderCompletion' for party '', service 'SAP_ERP_DEV' (internal name 'RfcClient[CC_IN_SAP_WorkOrderCompletion]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=400, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=aar, jco.client.sysnr=10, jco.client.ashost=53.249.196.86}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=400, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=aar, jco.client.sysnr=10, jco.client.ashost=53.249.196.86}
    Current pool size: 1, maximum pool size : 1
    Channel History
    - OK: 2006-12-19 11:12:58 CET: Message processed for interface ZBAPI_ALM_CONF_CREATE</i>
    and in messagemonitering audit log..
    <i>2006-12-19 11:12:58 Success Message successfully received by messaging system. Profile: XI URL: http://dcexi0602.alcan.com:50000/MessagingSystem/receive/AFW/XI Credential (User): XIISUSERDGX
    2006-12-19 11:12:58 Success Using connection AFW. Trying to put the message into the receive queue.
    2006-12-19 11:12:58 Success Message successfully put into the queue.
    2006-12-19 11:12:58 Success The message was successfully retrieved from the receive queue.
    2006-12-19 11:12:58 Success The message status set to DLNG.
    2006-12-19 11:12:58 Success Delivering to channel: CC_IN_SAP_WorkOrderCompletion
    2006-12-19 11:12:58 Success RFC adapter received an asynchronous message. Attempting to send tRFC for ZBAPI_ALM_CONF_CREATE with TID XIVqvZy8z94TkgWVR9u01m0m
    2006-12-19 11:12:58 Success The message was successfully delivered to the application using connection AFW.
    2006-12-19 11:12:58 Success The message status set to DLVD.
    </i>
    but the table is not updating...
    please guide me..
    regards
    ram

  • File to rfc...database tables not updating

    Hi friends..
    in file to bapi ..
    created ZRFC and in that rfc i given standard bapi and commit work..
    i tested in sap ..the table is updating..
    thru XI..the table is not updating...
    it showing likw this..in receiver rfc adpater monitering...
    <i>Receiver channel 'CC_IN_SAP_WorkOrderCompletion' for party '', service 'SAP_ERP_DEV' (internal name 'RfcClient[CC_IN_SAP_WorkOrderCompletion]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=400, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=aar, jco.client.sysnr=10, jco.client.ashost=53.249.196.86}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=400, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=aar, jco.client.sysnr=10, jco.client.ashost=53.249.196.86}
    Current pool size: 1, maximum pool size : 1
    Channel History
    - OK: 2006-12-19 11:12:58 CET: Message processed for interface ZBAPI_ALM_CONF_CREATE</i>
    and in messagemonitering audit log..
    2006-12-19 11:12:58 Success Message successfully received by messaging system. Profile: XI URL: http://dcexi0602.aaaa.com:50000/MessagingSystem/receive/AFW/XI Credential (User): XIISUSERDGX
    2006-12-19 11:12:58 Success Using connection AFW. Trying to put the message into the receive queue.
    2006-12-19 11:12:58 Success Message successfully put into the queue.
    2006-12-19 11:12:58 Success The message was successfully retrieved from the receive queue.
    2006-12-19 11:12:58 Success The message status set to DLNG.
    2006-12-19 11:12:58 Success Delivering to channel: CC_IN_SAP_WorkOrderCompletion
    2006-12-19 11:12:58 Success RFC adapter received an asynchronous message. Attempting to send tRFC for ZBAPI_ALM_CONF_CREATE with TID XIVqvZy8z94TkgWVR9u01m0m
    2006-12-19 11:12:58 Success The message was successfully delivered to the application using connection AFW.
    2006-12-19 11:12:58 Success The message status set to DLVD.
    please help me..
    regards
    ram

    Hi Sravya..
    yes i given commit work after bapi in ZRFC..
    in SAP..i tested ..its updating...but thru XI..
    it is showing success..
    but its not updating tables...
    thanks for your response
    regards
    ram

  • Updating policies and Policy Database or Policy Updates without server restart

    Hi again,
    I have implemented the flash access reference implementation server including setting up all example database tables (so we have a central database server).  I have started updating policies for the application "whitelist" features and have run into some questions below.
    The Protecting Content documentation states:
              "If your license server has access to a database for storing policies, you can retrieve the updated policy from the database and call LicenseRequestMessage.setSelectedPolicy()"
    This leads to two questions:
    1)  The reference implementation doesn't store any Policies in the database (it stores them on the filesystem in the Resources Directory).     I can not find any documentation or examples of how to "retrieve the updated policy from the database".     Can somebody please point me to an example or documentation on how to store policies in the database so I can simply LicenseRequestMessage.setSelectedPolicy()?
    2)  As the reference implementation stores policies on the disk I had to use policy update lists when I whitelisted an AIR app.     However, the reference server did not honor the policy update list till I restarted the flash access reference server.      How can I notify the flash access server of the change to the update policy list without restarting the server?
    Thank you,
    -R

    Hello,
    Please see my answers below.
    Answer 1>
    If you want to store the binary representation of the policy in the database, you can invoke Policy.getBytes() and store the returned byte[] as a blob in the database. For details on how to store such binary data in a database, you should consult the documentation for you database. Then, to rebuild a policy that had been stored in a database, you can obtain the byte[] stored in the database, and invoke new Policy(byte[]) with it to reconstruct that policy instance.
    See the following javadocs:
          * Retrieves an encoded byte array representation of the policy.
          * <p>If this <code>Policy</code> was created from an empty constructor, the revision number
          * will be <code>1</code>.  If this was an existing policy and changes were made to the policy,
           * the revision number will be incremented by one. Otherwise, the revision number will not change.</p>
          * <p>The validity of the policy is first checked before encoding into a byte array.  Encoding will fail
          * if {@link #checkValidity()} throws an exception.</p>
           * @return A serialized representation of the policy.
          * @throws PolicyModificationException The <code>Policy</code> cannot be serialized because it was created with a newer version and was modified.
          * @throws PolicyException The <code>Policy</code> is missing required fields or contains conflicting entries.
          * @throws EncodingException Unable to encode the <code>Policy</code> to a byte array.
          public byte[] getBytes() throws PolicyException, EncodingException;
          * This constructor parses an existing policy from the given byte array.
           * @param policy The policy from which to construct this <code>Policy</code>.
          * @throws EncodingException Unable to parse the byte array into a <code>Policy</code>.
          * @throws PolicyException The <code>Policy</code> is missing required fields or contains conflicting entries.
          public Policy( byte[] policy ) throws PolicyException, EncodingException;
    Answer 2>
    In order to implement automatic configuration updates of policy update lists on the flash access server, you will need to tweak the Reference Implementation code, to monitor the file update state and re-load the PolicyUpdateList if it changes. The code snippet below, taken from the com.adobe.flashaccess.refimpl.util.ParamsReader.buildHandlerConfiguration() method, should serve as an example of how the PolicyUpdateList is loaded and then set on the HandlerConfiguration instance for it to take effect for a particular license acquisition request. In the case of the reference implementation, this code (below) is only invoked once, during server initialization. That is why a server restart is necessary for subsequent changes to take effect. However, nothing prevents this code form being invoked elsewhere, and that implementation is entirely upto the customer, to achieve the desired outcome.
          PolicyUpdateList pul = PolicyUpdateListFactory.loadPolicyUpdateList(pulInputStream);
          if (pul != null)
                X509Certificate issuerCert = null;
                if (hsmEnabled)
                      issuerCert = getHSMCertificate(props, hsmUtils, "RevocationList.verifySignature.X509Certificate");
                else
                      String pulSignatureCertFile = props.getProperty("RevocationList.verifySignature.X509Certificate");
                      if (pulSignatureCertFile != null)
                            InputStream pulSignerInputStream = new FileInputStream(resourcesDir + pulSignatureCertFile);
                            issuerCert = CertificateFactory.loadCert(pulSignerInputStream);
                if (issuerCert != null)
                      pul.verifySignature(issuerCert);
                      context.setPolicyUpdateList(pul);
    Regards,
    Safdar

  • How to check  which column data differs from master table and archive table

    Hi All,
    i have two tables, table a (a1 number,a2 varchar2,a3 varchar2) and table b (b1 number,b2 varchar2,b3 varchar2).
    how to check the data in both the table are same( including all columns).
    data in a.a1 is same as b.b1 and a.a2 is same as b.b2 like that.
    if they not same , i need to know which field differs.
    Kindly Share ur ideas.

    887268 wrote:
    thanks Sven W. ,
    above reply clearly shows what my question is.
    one column must be primary key, based on that key i need to find out which are the fields having different data..
    im strugling with this, i tried the following already, but not able to get.
    select the columns from a MINUS select the columns from b.
    -- from this i can find whether the difference occurred or not.
    but i cant able to get which are the fields value changed.Good. Then you would match the rows using the PK column and need to compare the columns
    Instead of a MINUS + UNION ALL + MINUS we can now use a FULL OUTER JOIN
    It is a little task to write out all column names, but 40 columns can be handled.
    This statement would show you both tables with matching rows on the same line.
    select a.*, b.*
    from a
    FULL OUTER JOIN b on a.id = b.idNow filter/check for mismatches
    select case when a.col1 != b.col1 then 'COL1 value changed'
                    when a.col2 != b.col2 then 'COL2 value changed'
                    when a.col3 != b.col3 then 'COL3 value changed'
             end as compare_result
            ,a.*, b.*
    from a
    FULL OUTER JOIN b on a.id = b.id
    /* return only non matching columns */
    where (a.col1,a.col2,a.col3) != (b.col1,b.col2,b.col3) You might need to add nvls to take care of null values. Test this!
    Another way could be to group upon the primary key
    select *
    from (
      select id 
               ,count(distinct col1)-1 cnt_col1
               ,count(distinct col2)-1 cnt_col2
               ,count(distinct col3)-1 cnt_col3
       from
         select 'A' source, a.*
         from a
         UNION ALL
         select 'B' source, b.*
         from b)
       group by ID
    /* only records with differences */
    where 1 in (cnt_col1, cnt_col2, cnt_col3)
    ;The count columns will hold either 1 or 0. If it is 1 then this column has a difference.

  • Based on input file i need to update default values to some columns of database table using bulk copy process

    Hi Team,
    Am using BULK INSERT Format file option to load data into table from .txt file here am facing an issue i.e ibased on input file i need to insert default values to some columns of table so we can not declare it on table level, Can we give default values in
    format file ? if we can give how it is ? or Any alternate possibilities to this scenario instead of BULK INSERT ?
    Thanks,
    Sudhakar

    Thanks for your response, here i don't have any rights to change table structure the table is created by different team, my work is to load data from file to table. Is there any chance to supply default values by*XML* format file instead of *.fmt* file
    please let me know the possibility.
    Again, no. If you want to supply default values that are not present in DEFAULT constraints in the table definition, you will need to write your own code. There are plentyfull of options, and I have mentioned some already.
    Here are some more:
    *  Table-valued parameters, see here for examples:
    http://www.sommarskog.se/arrays-in-sql-2008.html
    *  Use BULK INSERT to load data to a staging table, and then apply the default values when you copy from staging to target.
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • Lion finder icons relocating

    With Lion, Mac pro, every time I stsrt up the finder icons move to a different location. Apple has been unable to help. I have tried changing settings, arrange by name, list, column etc, but I use none..none as my preferred layout in the users finder

  • Buffer and relate using single table

    I have a table with a geometry column representing parcel information with the shape of the parcel. I need to write a query that will select 1 or many parcel(s) from this table based on the parcel ID, but also select all parcels within 300 feet of th

  • Double Click Property Node not functioning with Queued State Machine

    I am writing an application which relies on input from the operator to start different steps in a process of steps.  I am using a queued state machine, however I cannot get the Double-Click property of my listbox to function with in this Queued state

  • Link in 365 Email Disclaimer

    Hi, Is it possible to put a link in an email disclaimer in Office 365? (Mailflow, Rules) This topic first appeared in the Spiceworks Community

  • How do you change the administration password if you have no CD?

    My dad set up my computer and therefor he had the administration password. I just moved out and did not leave on a good not with him, so I can not access the password. I was wondering if you could help me reset it.