Update column automatically

I have a table called indicator_dimensions and in this table the columns like create_user, create_date,modified_user,modified_date. and on the basis of this table i have created a report. what i want is the mentioned 4 columns get automatically updated in the database,on the basis of whoever has creatied this dimension will be the create_user and at what date will be the create_date and whoever is modifying this dimension will be the modifed_user and at what date will be the modified_date. is it possible to achieve like that.
This is the code of my report
select
"IND_DIM_ID",
"IND_DIM_ID" IND_DIM_ID_DISPLAY,
"INDICATOR",
"DIMENSION_ID",
"CREA_DATE",
"CREA_USER",
"MODI_DATE",
"MODI_USER",
"IS_PREDICATE"
from "#OWNER#"."INDICATOR_DIMENSIONS"
where indicator=:P54_indicator

Hi,
I think database trigger is best for this case
create or replace TRIGGER
"BIU_INDICATOR_DIMENSIONS" before
  INSERT OR UPDATE ON "INDICATOR_DIMENSIONS" FOR EACH row
BEGIN
  IF inserting THEN
    :NEW."CREA_USER" := NVL(v('APP_USER'),USER);
    :NEW."CREA_DATE" := sysdate;
  END IF;
  IF updating THEN
    :NEW."MODI_USER" := NVL(v('APP_USER'),USER); 
    :NEW."MODI_DATE" := sysdate;
  END IF;
END;Br, Jari
Edited by: jarola on Jan 12, 2010 3:15 PM

Similar Messages

  • Update data automatically in sql server 2005 based on condition proplem

    Hi guys i have problem I have two table
    First one is
    Second One is Vacation
    as relation one to many (vacation has foreign key of Contract No OF Table Contract) 
    what i need is to update Contract table with field status =Finish where start vacation date >end contract Date
    How i do that in sql server 2005 to make update automatically
    Ex
    contract table
    status             nvarchar(20)
    end contract    date time
    vacation table
    start vacation date time
    end vacation date time
    start vacation date is 23/10/2014
    and End
    is 26/10/2014
    Now not update status in contract table to finish because vacation date start is less from end contract
    but when date today is 27/10/2014 update contract table field status to finish
    automatically with sql server 2005 
    How i do that condition to make update to data automatically based on changing on date
    Update statement i need is 
    update Contract set status = finish where start vacation>end contract
    but problem how i write this statement to update data automatically based on date today

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. You failed again. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. Now we have to write the DDL that you did not bother with! What you did post was wrong! There is no key or constraints. There is no generic “status” in RDBMS; a "<something in particular>_status"
    is a state of being, so it needs a temporal duration. The correct idiom for this data model is: 
    CREATE TABLE Vacations
    (vacation_contract CHAR(15) NOT NULL PRIMARY KEY,
     vacation_start_date DATE NOT NULL,
     vacation_end_date DATE,
     CHECK(vacation_start_date < vacation_end_date),
    Oh, a field is nothing like a column. You need to read a basic SQL or RDBMS book; you do not know the basics. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Mass Update Column In Tabular Form

    Hi,
    I'm trying to create a tabular form that has a mass update column function. i.e. the tabular form will be displayed as normal but at the top of certain columns will be a text box or lov and what ever is entered into those boxes will be cascaded into the empty values in that column without refreshing the page.
    Hope that makes sense.
    I've search the forum but cant find reference, is this possible.
    Thanks Andy

    Hi,
    Just wondering if anyone had any thoughts on this.
    I can get the text to populate another cell e.g.
    http://mlw-mis-2/dev/apex/f?p=174:4
    But how can i get it to reference a column, this is what I'm using to reference another item
    onKeyUp="f_getTextUpper('P4_COL1','P4_TEXT')"
    and I've tried changing the P4_TEXT to other things like
    apex_application.g_f03 (vRow)
    apex_application.g_f03 (i)
    apex_application.g_f03
    But with no luck

  • Get OLD&NEW value of an UPDATED column selected dynamically in a Trigger

    Hi All,
    I am writting a trigger which take column name dynamically. And on the basis of that column it should give me old value as well as updated value of a column corresponding to a modified row.
    OOO_SCHEDULE is my table name;
    Note: This is only for test so I am writting only for update not for insert and delete.
    create or replace trigger "OOO_SCHEDULE_AUDIT"
    BEFORE
    insert or update or delete on "OOO_SCHEDULE"
    for each row
    begin
    DECLARE
    v_username varchar2(30);
    AUDIT_EMP_ID varchar2(30);
    AUDIT_EMP_ID_NEW varchar2(30);
    v_Column_name VARCHAR(30);
    v_stmt1 VARCHAR(40);
    v_stmt2 VARCHAR(40);
    CURSOR C1 is
    select COLUMN_NAME from user_tab_columns where table_name='OOO_SCHEDULE';
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 into v_Column_name;
    EXIT WHEN c1%NOTFOUND;
    v_stmt1:=('OLD.'||v_Column_name);
    v_stmt2:=('NEW.'||v_Column_name);
    AUDIT_EMP_ID:=v_stmt1;
    AUDIT_EMP_ID_NEW:=v_stmt2;
    INSERT INTO TEMPTEST VALUES(v_stmt1);
    INSERT INTO TEMPTEST VALUES(AUDIT_EMP_ID);
    END LOOP;
    CLOSE c1;
    END;
    end;
    Suppose OOO_EMP_NAME is the column name where user made the change.
    If i do like this..
    AUDIT_EMP_ID:=OLD.OOO_EMP_NAME;
    AUDIT_EMP_ID_NEW:=NEW.OOO_EMP_NAME;
    Then it is working fine because I have given column name statically. But I want the column name to be selected dynamically and I am able to do it through cursor. Also I am able to fetch all column names in v_Column_name variable one by one dyanamically for the cursor.
    But by executing these statements
    AUDIT_EMP_ID:=v_stmt1;
    AUDIT_EMP_ID_NEW:=v_stmt2;
    I am getting OLD.OOO_EMP_NAME and NEW.OOO_EMP_NAME rather then old and new values of the updated column.
    Please help me identifying the problem, where I am doing the mistake? What is the correct way to execute these statements? So that I can get old and new values of the column (updated column).
    I have tried it by passing in a procedure also but don't know how to execute this dynamic statement to get the old and new values.
    Thanks,
    Ishrat.

    In the given link, column name has been selected statically. But i want that column name should be selected daynamically throgh loop and then check the
    condition for any update corresponding to that column value. I don't want to write as many if condition as the no. of column name. I just want one if condition for all column namesDon't be lazy. Write all column names into your trigger. Or use a way to create the trigger "dynamically".
    What is the problem that you have with static column names? "I don't want to write many..." is not a problem, but an opinion.

  • Int Server (ABAP Cache) - Cache Updated column shows "red"

    ...long read, appreciate your patience...
    In the IB:Config, under Cache Notifications, I'm getting the red square in the Cache Updated column for all "ABAP Cache" entries (green for notification).   The "Java Cache" and "Central Adapter Engine" entries are green all the way through.
    I've read a bunch of other threads here, and I've read and worked through the entire "How to Handle Caches" document.  I ran in to a couple issues, but I don't know how to solve them.....
    1) When I run SXI_CACHE, I receive the following messages:
    <green> "Cache contents are up to date"
    <red> "Error during last attempt to refresh cache"
    --->double-clicking shows: Error ID = BUSINESS_SYSTEM, Message = LCR_GET_OWN_BUSINESS_SYSTEM - NO_BUSINESS_SYSTEM
    --->Running the LCR... fxn via SE37 is successful, so I don't understand why SXI_CACHE has a problem running it.
    2) When I run the Cache Connectivity Test where the Yellow triangle is displayed for the IS-ABAP with message "Attempt to fetch cache data from Integration Directory not yet started or still in progress".
    3) When I try to load http://<host>:<port>/CPACache/refresh?mode=delta or full, I get a "403 Forbidden - You are not authorized to view the requested resource."  But I'm never prompted for a user/pw?  Since I'm the only user in this XI box, I do have some of my logons saved in Internet Explorer - could it be using one of those without prompting me?
    Note:
    I have been experiencing on and off network issues, and the machine we have XI installed on is slow.  I don't know if that could affect anything or not.
    Thanks for taking the time to read this...
    Brian
    Message was edited by: Brian Vanderwiel

    Thanks for the replies...
    Prashanth,
    I think SXI_CACHE is for items in the Java stack only (correct me if I'm wrong).  The main problem I have is with items in the ABAP stack not making it in to the cache.
    Moorthy,
    I walked through the Readiness Check - everything passed except for the items I already mentioned (Cache test shows yellow).  The document is a nice gathering of tests, but it doesn't offer any ideas has to how to correct problems encountered.
    Integration_directory_hmi tested successfully, and I read through the other OSS Notes, but none solved the issue.

  • Update column data to Upper Case in parent and child table

    Hi ,
    I am facing issue while updating column value to upper case in parent table and child table. How can i do that ?
    when updating parent row:
    ORA-02292: integrity constraint (XXXXXXXXXXXXXX_FK) violated - child record found
    When updatng corresponding child row:
    ORA-02291: integrity constraint (XXXXXXXXXXXXXXXX_FK) violated - parent key not found
    how can i update on both the places ?
    Regards,
    AA

    I am facing issue while updating column value to upper case in parent table and child table. How can i do that ?
    Why do you need to do that?
    That is just ONE of several questions you should answer before you start modifying your data.
    1. What is your 4 digit Oracle version? (result of SELECT * FROM V$VERSION)
    2. If both values are the same case what difference does it make what that case is?hen you don't need to alter your original data.
    3. What is the source of the column values you are using now? If you change your data to upper case it will no longer be identical to the source data.
    4. What is your plan for enforcing future values to be stored in UPPER case? Are you going to use a trigger? Have you written and tested such a trigger to see if it will even work the way you expect?
    5. Why aren't you using a surrogate key instead of a 'business' data item? You have just demonstrated one reason why surrogate keys can be useful: their actual value is NOT important.
    You should reexamine your problem and architecture and consider other alternatives.
    One alternative is to add a new 'surrogate key' column to use as the primary key. Just create a new sequence and use a trigger to populate the new column. Your current plans will require a trigger to perform the case conversion so instead of the just use the trigger to provide the value.
    If the change is being done to facilitate searching you could just add a VIRTUAL column UPPER_MY_COLUMN and index that instead. Then you could search on that new virtual column and the data values would still be identical to the original data source.

  • How to expand the hierarchy column automatically when delivery reports by a

    Hi Experts,
    In OBIEE 11.1.1.6.0,how to expand the hierarchy column automatically when delivery reports by agent?
    For example:
    In SampleLite RPD, when we drag "Time Hierarchy" and Sales column into the report , and sent it by agent ,it will only display "Total" sales, not show all level value,such as Year,Month,Day.So how to expand the hierarchy column automatically when delivery reports by agent?
    If we expand all levels and save them, it will be ok, however, when we add new data, it will be collpased automatically and not show the lowest level data, requiring Users or Developer to modify this report for expanding the hierarchy. We think it is very trouble, is there any good suggestion or method for achieving our requirement?

    958054 wrote:
    Hi Dpka,
    Is it any difference? I look at the result is same.
    Firstly, you said it is 'Add member of ',
    Now, you said it is 'Keep member of'
    Could you please tell me which options I must select ? Thanks very much.Here is some notes from the documentation to make a better sense of how those two options would work:
    •Selection steps — When you create selection steps, you can add a group or a calculated item in a step. Subsequent Keep Only or Remove steps might reference members that were included in the group or calculated item.
    ◦A group list is affected by members that are kept or removed in subsequent steps, but the group outline value remains the same. For example, suppose the MyNewYork group contains Albany and Buffalo and its value is 100. Suppose Albany is removed in a later step. The value of the MyNewYork group remains at 100, but Albany is no longer listed with the group.
    ◦A calculated item is not affected by members that are kept or removed in subsequent steps, because removals can affect the components of the formula.
    •Groups and calculated items — A step can include a group or calculated item. Groups and calculated items can be used only with Add steps; they cannot be used in Keep Only or Remove steps.

  • How to obtain the updated column name in a trigger?

    Hello everyone,
    I need to know for audit propose the updated column name in a After Update Trigger on a Table.
    The table have more than 20 columns, and i think that do more than 20 conditions asking for the difference between the :new value and the :old value is not the best way.
    Thanks for the help!
    LCJ

    Hi,
    Thanks to all for the replays.
    I didn't know that i can pass the column name to the UPDATING. This is only possible on 10g??
    Any way, i pass the column name and works fine, but i have another issue because of that.
    I obtain the column name from a cursor that query user_tab_columns view, when i try to obtain the value of the :old or :new, i can't because i don't know how to obtain the value of the value.
    This example show better:
    DECLARE
    vOldValue Varchar2(50);
    Cursor cur_Column_Names Is
    Select COLUMN_NAME
    From User_Tab_Columns
    Where TABLE_NAME = 'table_name';
    BEGIN
    For var_cursor In cur_Column_Names Loop
    If Updating(var_cursor.COLUMN_NAME) Then
    vOldValue := '?'; -- How obtain the value of the :old. + >var_cursor.COLUMN_NAME??
    End If;
    End Loop;
    END;Thanks to all for the help.
    LCJ

  • Combine checked item and update column

    Hi all,
    need to design a screen that allow user to update column (code) and also pick which statement to display for the next stage. My thought was to create a checkitem and LOV display. Once user has checked the box , the process should update the code first then select the checked item into a new table. But it appears to me I can get checked item cocept to work and inserted it to a new table but fail to address the LOV update. Can you help ?
    table: sample1, display as the following
    seq     code     comments amt
    1     T     test1     30
    2     A     test2     20
    3     T     test3     80
    4     T     test4     20
    user action: picked seq 1,2  and update code from A to T for seq2
    ==> process will insert the selected statement to result table
    table:result
    seq     code     comments amt
    1     T     test1     30
    2     T     test2     20mushar

    I am sorry . Just realized I posted this to a wrong forum.

  • I do not want iOS to update itself automatically, does it do this?

    I am new to the iPhone, and iOS.
    I have an iPhone 4s running iOS 5.0.1 I hear 5.0.2 is coming out any day now.
    As a Mac user I always like to wait after an update is released to read the feedback.
    Will iOS update itself automatically?
    If so how do I disable this?

    No, it wont update automatically. You can either go to the computer, or update in Genral Settings (if so, over wifi because it gets expensive for a high data download over 3g).
    Thank you for choosing Apple.

  • VE 108 or How can I update prices automatically

    Good day to everyone!
    I've got some problem with a tax determination in MM.
    Condition type - MWST.
    I created a personal condition table (501) with only field - Tax code.
    Also I changed access sequence for MWST with that table.
    I entered condition records for a new table via MEK31.
    Problem!
    When I create purchase order (ME21N) I enter a tax code on the "Invoice" tab. But, tax in the calculation schema doesn't determined. In pricing analysis there is an error message VE 108. After updating prices (G - Copy pricing elements unchanged and redetermine taxes) - tax succesfully determines.
    Can I customize updating process automatically? Where? In schema?
    Thanks a lot!
    Message was edited by:
            Timur Baimuldin

    Hey!
    Thanks Vijay
    I dont know why but changing the cost center does not trigger the user exit EXIT_SAPLMEKO_002, needed for the correct price determination. I think this is the cause of the message VE108.
    Does anybody know if it is normal that that user exit is not called when changing the cost center?
    some other ideas?
    Regards!

  • Update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow

    Hi,
    We have a requirement to update a column value once the item has been approved.
    Following settings have been made in the publishing articles list:
    Require content approval for submitted items : yes
    Create major and minor (draft) versions
    Who should see draft items in this document library? :Only users who can edit items
    Require documents to be checked out before they can be edited? : yes
    I have createdatu a Sharepoint 2013 workflow to check if Approval sts of current item = 0 i.e. Approved , then check out and update the item and finally checkin the item. Everything works fine till this point except that the minor version of the item is
    checked in. Due to this the updated columns are not published to others.
    Also, I created a Sharepoint 2010 workflow to SET CONTENT APPROVAL = APPROVED and started this workflow from my list workflow above, but the item does not get checked-in and always shows "In Progress" status with comment "The item is currently
    locked for editing. Waiting for item to be checked in or for the lock to be released.".
    Please let me know where I am missing out so that once the item is approved, column value gets updated and current item is still in Approved status.
    Thanks

    Hi,
    According to your post, my understanding is that you want to update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow.
    You will get into this kind of Catch-22 situation trying to set the Content Approval Status in SharePoint Designer workflow:
    - You must check out the document before you can change the Content Approval Status
             - You can't change the Content Approval Status once the document in checked out
    Since you set the Require documents to be checked out before they can be edited=Yes, you will need to check out the document when run the workflow on the item. But you cannot approve a document when it is checked
    out. So the logic in workflow conflicts.
    As a workaround, you can use the Start Another Workflow action to start the normal Approval workflow on the document.  The built-in Approval workflow can work with a document that’s not checked out.
    The designer approval workflow also can work with a document that’s not checked out.
    You can create two workflow using SharePoint Designer 2013.
    First, create a SharePoint 2010 platform workflow.
    Then, create a SharePoint 2013 platform workflow.
    Then when the SharePoint 2013 platform workflow start, it will start the SharePoint 2010 platform workflow to set content approval status, then the SharePoint 2013 platform workflow will update current item value.
    More information:
    SharePoint Designer Workflow Content Approval Issue
    SharePoint 2010 Approval Workflow with Content Approval
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Datastore: Update data automatically functionality

    Hi Experts,
    I have a datastore object DSO1(target) that is fed from another datastore Object DSO2(source).
    The source DSO (dso2) is fed from table in R/3 via an infopackage and DTP (BI 7.0 model).
    The target DSO (dso1) gets data from the source via an update rule (BW3.5).
    I checked the following settings on DSO2 (source)
    <b>"Update data automatically"
    "activate data automatically" </b>
    <b>When i run a manual load on DSO2 (source) the request that is loaded gets updated automatically into the target - DSO1 and gets activated automatically - as expected
    </b>
    However <b>when I run a process chain </b>which uses the same infopackage and DTP to load a similar request into the source-DSO2 the corresponding request <u><b>DOES NOT</b></b></u> <b>get updated automatically</b>. I have to rt click on DSO2 and trigger an update via "Update data in 3.x data target" to load the request.
    Can anyone please tell me why the request would update for manual loads and not loads via process chain.
    I used the process type "Update Data Store Object Data (Further Update) " to update the data but i don't want to do this because we are planning to keep the target ODS1 in a different process chain.
    I can schedule an infopackage in the other process chain to load data from source DSO but it is extremely important that every time a request gets loaded into source DSO it gets updated into the target DSO. This is because of certain delta issues we are having when we try to load multiple requests from source into target at a time.
    "Get data by request" on a 7.0 DTP won't work either since every execution of DTP gets only one request at a time. If we want to load multiple requests we need to execute DTP multiple times (cannot be automated!).
    Helpful answers will be rewarded.
    MM<u></u>

    Hi,
    I guess you could create a Metachain and create the dependency between the 2 process chain. The you'll also be able to include the variant that you need in the metachain itself.
    Hope this helps.
    Thanks,
    Ashish

  • Update Data Automatically

    I have created a new ODS. In the ODS, the "Update Data Automatically" and "Activate Data Automatically" indicators are checked...I then created a Cube linked to this ODS.
    Because of the Update Data Automatically indicator is checked in ODS,so system will then update the data automatically up to the data target (InfoCube).
    Question is because I am now using the Transformation between InfoCube and ODS, does the update data will still happened automatically?
    Or I have to create the DTP and schedule the Process Chain?

    Hi.....
    "Activate Data Automatically" indicators is generally ignored while using a Process chain.......
    Solution -
    Use process chains to automate data activation.
    You are right........Update Data Automatically indicator is checked in ODS,so system will then update the data automatically up to the data target (InfoCube).....................But this settings are in most cases ignored ,becoz in a prod environment process chains are used........to load DSO......when process chains are used  both the settings..Update Data Automatically" and "Activate Data Automatically"........are ignorde.......
    So create a DTP........
    Hope this helps......
    Regards,
    Debjani.........
    Edited by: Debjani  Mukherjee on Oct 23, 2008 7:19 AM

  • Hz_party_site_v2pub.update_party_site-You cannot update column location_id

    Hi All,
    I am working on customer conversion and need to call hz_party_site_v2pub.update_party_site. It throws me error "You cannot update column location_id".
    Follwoing is the scenario:
    1. Initially, I create a customer, with bill to and ship to addresses different from each other.
    New Customer: 12345678
    Bill To: 1 ADDRESS
    Ship To: 2 ADDRESS
    Result:
    1 customer got created.
    2 sites got created one for bill to and one for ship to.
    2 Locations got created , one for bill to and one for ship to address.
    2. Now, I try to update the bill to and ship to address for the customer and my new bill to ship to are
    Bill To : 1 ADDRESS
    Ship To: 1 ADDRESS
    Now, when the code hits the point hz_party_site_v2pub.update_party_site() it returns the error message "You cannot update column location_id".
    Any pointer to resolve the issue or throw some light on the situation would be of great help.
    Thanks in Advance !
    Lalitha.

    Hi,
    Please see if (How to Update an addressee Field Information using TCA API [ID 219595.1]) helps.
    Thanks,
    Hussein

Maybe you are looking for

  • Unable to install Oracle 8.1.7 Enterprise Edition on a Dell Dimension 4400

    I just bought a Dell Dimension 4400 computer. I tried many times to install Oracle 8.1.7 Enterprise Edition on it. My operating system is Windows XP Professional. It seems nothing to do with the Operating system because I installed the database on a

  • Photo Stream not working on my Mac since upgrade to Mountain Lion

    I've noticed that Photo Stream isn't downloading new photos that I've taken on my iPhone since I upgraded to Mountain Lion. My iPad is syncing just fine. I've tried both iPhoto and Aperture on my Mac, neither seem to be receiving new photos in the st

  • FM RADIO STOPPED WORKING ZEN 8GB

    Hello All, This is my first post. I own a Creative Zen 8GB player and suddenly the FM Radio is no longer working. All firmware is up to date. All other apps in working order. Radio bars are not lit up. The same headphones do work on my Creative Zen S

  • Can this page be made all in Dreamweaver?

    http://www.mammothmountain.com/MyMammoth/?section=weather I like the collapsing panels, and especially the folder-like tabs under the "WEATHER" section. Are these tabbed folders ("Extended Forecast", "Resources", "Road Conditions") collapsible Spry p

  • Resizing image in photoshop

    Hello, I'm new to photoshop and trying to resize an image  to become 1080 x 1020 at 72 lpi. Original size is 2173 x 1634 at 300. (Asset is for viewing only) First, I went into "Image Size" dialog box, checked "Resample Image" and unchecked "Constrain