One Update Statment

Hi ,
I wana use two column conditionally in an update statement rather then writing two statement for each conditions.
  update war_room_report_aged
     set case when p_business_days_old=15 then nrpc_15_days
              when p_business_days_old=25 then nrpc_25_days
              when p_business_days_old=10 then nrpc_10_days end  = exceeds_sr.c_date_recd
   where bus_unit_abbrev = exceeds_sr.abr_bus_unit||'_'||exceeds_sr.abr_sub
     and todays_date     = p_end_date
     and tio_priority    = p_level;I can do it with two statement seperatly ,but i got in a situation where there would be more than 5 columns need to be updated according to parameter's value.
if p_business_days_old=15 then
update war_room_report_aged
     set  nrpc_15_days=exceeds_sr.c_date_recd
   where bus_unit_abbrev = exceeds_sr.abr_bus_unit||'_'||exceeds_sr.abr_sub
     and todays_date     = p_end_date
     and tio_priority    = p_level;
elsif p_business_days_old=25 then
update war_room_report_aged
     set  nrpc_25_days=exceeds_sr.c_date_recd
   where bus_unit_abbrev = exceeds_sr.abr_bus_unit||'_'||exceeds_sr.abr_sub
     and todays_date     = p_end_date
     and tio_priority    = p_level;
elsif .. then
end if;Can i made the same above in one statment?I am so devastated as there gonna be more than 10 conditions for 10 parameter and for each parameter's value relate to seperate 10 cloumns.

You can do it this way:
create table test_table
pk_col     number,
cond_1     number,
col_1      varchar2(5),
cond_2     number,
col_2      varchar2(5),
cond_3     number,
col_3      varchar2(5)
insert into test_Table values (1, 10, 'AAA', 20, 'BBB', 30, 'CCC');
update test_table
   set col_1 = decode(&input, 10, col_1 || '1', col_1),
       col_2 = decode(&input, 20, col_2 || '1', col_2),
       col_3 = decode(&input, 30, col_3 || '1', col_3)
where pk_col = 1;
select *
  from test_table;
PK_COL                 COND_1                 COL_1 COND_2                 COL_2 COND_3                 COL_3
1                      10                     AAA1  20                     BBB   30                     CCCLogic is to check if the variable matches a certain Input condition, then update the column with new value, else just update it with Itself. This way, you achieve it in a single SQL and still do not risk losing column information.

Similar Messages

  • How to download versions of apps compatible with OSX 10.7 not the ones updated for 10.9

    how to download versions of apps compatible with OSX 10.7 not the ones updated for 10.9?
    I'm trying to download iLife and iWork apps for my MacBook. For example: The GarageBand app will not download because it says it is compatible with 10.9. I have 10.7 and cannot update to 10.9 because I'm on a 13in. Late 2007 MacBook. Any suggestions?

    Click here and follow the instructions. If they’re not applicable, you can’t download them and need to install them from a DVD.
    (108988)

  • More than one updatable report on one page.

    I hope someone can help me with this.
    I've spend a long time looking for the best way to do this but keep running into APEX constraints.
    My problem is that I have two tables;
    1) an 'object' table with static attributes (that can change value but keep no history).
    2) an 'object attributes' table with attributes that can change over time (i.e. keep a history).
    Some of the attributes are optional and some mandatory irrespective of whether they are static or timestamped.
    I want to design a screen that shows both tables on one page - preferably both updatable on the same screen.
    Selecting/clicking a row in the top table (object) will select the appropriate object attribute rows in the table below (I've got that covered - no help needed there).
    If I create a new object record I also need to create an initial object attributes record.
    This first initial attributes record cannot be deleted while the object exists.
    The start date of the object itself and its first object attributes record should remain in sync.
    I cannot separate the object table and attributes tables on different pages as all static and timestamped attributes form one collection that needs to be visible and maintainable from one screen.
    The problem is APEX will not allow more than one updatable (or interactive) report on one page.
    I need a solution where both tables are maintained in a uniform way for the user.
    Not, for instance, one table an updatable report and the other a report with detail form.
    Anybody struggle with a similar problem and found a solution to this problem?
    Any pointers are most welcome.
    Ruud.
    PS. I have a joined view on both tables with an INSTEAD trigger that can process insert/update/delete's on the combined data however I would not like to use that if I can avoid it. It would mean a repetition of static attributes in the one updatable report.

    Andy,
    Apologies for the late reply - Forums have been out for a while :-(
    Thanks for the suggestion. I've had a look at Denes' example and
    at least now I know it is possible.
    I've asked for access to his workspace but have not been given that
    yet so can't look at the details yet but I can make some educated
    guesses as to how it was done.
    I will give it a try.
    I'm still not certain whether having 2 updatable tabular reports is the
    right way to go though....
    Currently I'm working on a page with 2 navigator reports - one for selecting
    the object and another to select the start date of the timestamped attributes.
    Next to that I have an updatable detail form that shows the selected object
    and attributes as one whole set using the joined view I mentioned earlier.
    Inserts, updates & deletes are then done in the form.
    Ruud.

  • How does one update Flash? I currently cannot watch videos on You Tube, it says I need to upgrade, I have no problem doing this on a PC.

    How does one update Flash? I currently cannot watch videos on You Tube, it says I need to upgrade, I have no problem doing this on a PC.

    If you're not using chrome you can just go to adobe's website (http://get.adobe.com/flashplayer/) and download the newest flash player.  You run the .dmg and then open the application, which updates flash.  With the latest version of flash there should be a preference pane within system preferences to allow you to change settings and check for updates.

  • How does one update Subtemple value from Yes to No?

    Greetings! In the instructions of a published problem statement (Note ID: 808571.11) there is a line that says:
    "c) Check if the subtemplate is set to NO. Update it to NO if it is set to Yes."
    How does one update the Subtemplate value from Yes to No? In edit configuration, I do not see a Subtemplate value column.
    Many thanks in advance fr your suggestions.
    Tom

    With all due respect ... I do not see how one can change the Subtemplate value from Yes to No. When I query the offending Template, the Subtemplate column is not displayed in bold, indicating to me that it can not be updated. Clicking on Edit Configuration, doe not provide an ability to change the value either.
    As best I can determine, one needs to 1) query up the template
    2) download the rtf file(s)
    3) end date the template
    4) create a new template and then set the Subtemplate value to No.
    And the same steps appear to be required in order to add or update a template Description.
    Which raises the question, Why can this not be done by editing the configuration?

  • In my app store i have one update which is angrybirds so i go to update it despite me not have and it say that i need to sign into (my) account i have two unauthorized apps FCP 10 and Motion 5 and i tried the other hack thingy help?

    n my app store i have one update which is angrybirds so i go to update it despite me not have and it say that i need to sign into (my) account i have two unauthorized apps FCP 10 and Motion 5 and i tried the other moving the masreceipt thingy help?
    <E-mail Edited by Host>

    Have you checked to see whether the App Store appis hidden via Settings > General > Restrictions > Installing Apps being set 'on' ?

  • Problem in update statment when using where condtion

    Hi ,
          Iam using update statment to update field in Z-Table .My statment is not working fine as per my requirement.The statment is as below,
    UPDATE ZFINAL_DATA  SET ZDATE_FLAG = SPACE where ZGLOBAL_CODE ( SELECT LIFNR FROM LFA1 WHERE KTOKK = 'ZLIE' ).
    But this statment is doing my purpose .
    My requirement is , I need to update ZDATE_FLAG = SPACE in ZFINAL_DATA table when LFA1 -LIFNR = ZFINAL_DATA-ZGLOBAL_CODE and LFA1-KTOKK = 'ZLIE'.
    Can any correct the update statment which will be helpfull to proceed further .
    Regards,
    Sriram

    Hi Sriram,
    Have a look into the logic of the below query. Maybe this will fulfil the requirement.
    TYPES:     BEGIN OF lt_lifnr,
             lifnr TYPE lifnr,
         END OF lt_lifnr.
    DATA:      la_lifnr TYPE TABLE OF lt_lifnr,
           wa_zfinal_data TYPE zfinal_data,
           la_zfinal_data TYPE TABLE OF zfinal_data.
    TABLES: zfinal_data.
    SELECT lifnr
    FROM lfa1
    INTO TABLE la_lifnr
    WHERE ktokk = 'ZLIE'.
    SORT la_lifnr BY lifnr.
    SELECT *
    FROM zfinal_data
    INTO TABLE la_zfinal_data.
    LOOP AT la_zfinal_data INTO wa_zfinal_data.
      READ TABLE la_lifnr WITH KEY lifnr = wa_zfinal_data-zglobal_code
                          BINARY SEARCH TRANSPORTING NO FIELDS.
      IF sy-subrc = 0.
        wa_zfinal_data-zdate_flag = space.
        MODIFY la_zfinal_data
        FROM wa_zfinal_data
        INDEX sy-tabix
        TRANSPORTING zdate_flag.
      ENDIF.
    ENDLOOP.
    MODIFY zfinal_data FROM TABLE la_zfinal_data.
    COMMIT WORK.

  • UPDATE statment

    hi for all, plz i have a question ,i have a tabel called (ClientT) which contain these fielde
    First_Name
    Last_Name
    UserID
    Address
    Password
    BirthDate
    Answer
    and i need to make an Update to this table according to some informatio ,My Code
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              String url = "jdbc:odbc:test";
            // Step 2: Establish the connection to the database.
              java.sql.Connection c = DriverManager.getConnection(url,"", "");
              java.sql.Statement st = c.createStatement(); 
              String Query = "UPDATE ClientT " +
                             "SET Password = 'pass' "+
                             "WHERE (Address LIKE 'city') AND (BirthDate LIKE 'birth') AND (Answer LIKE 'color')";
              st.executeQuery(Query);        
             st.close();
             c.close();
         catch(SQLException ex) {
            System.err.println("SQLException: " + ex.getMessage());
         catch(ClassNotFoundException ex) {
             System.out.println("Class Not Found Exception ");               
              }when the trace reach
    String Query = "UPDATE ClientT"+
    it jump to th st.close();
    what is the problem, the problem is with the UPDATE SQL Query.is the structure of this query correct??
    Thanks.

    thank you for your third point i make it but still the code not done what i need (update the password in the tabel according to certain Client information),
    i dont have an error to do
    exception.printStacktrace();
    the code not produce an error through debugging,or through run,so i thing the UPDATE statment not coorect.
    i use this UPDATE statment for the first time so i dont sure is the structure of it right or not, and i using NetBeens IDE.
    can you help me or give me an examples of UPDATE Statment.
    thank
    i have a question< is there is a diffrence when i replace the LIKE whith = in my SQL query?
    my final code is
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              String url = "jdbc:odbc:test";
            // Step 2: Establish the connection to the database.
              java.sql.Connection c = DriverManager.getConnection(url,"", "");
              java.sql.Statement st = c.createStatement(); 
              String Query = "UPDATE ClientT " +
                                    "SET Password = ('"+pass+"') "+
                                    "WHERE (Address = 'city') AND (BirthDate = 'birth') AND (Answer = 'color')";
              st.executeUpdate(Query);        
             st.close();
             c.close();
         catch(SQLException ex) {
            System.err.println("SQLException: " + ex.getMessage());
         catch(ClassNotFoundException ex) {
             System.out.println("Class Not Found Exception ");               
              }Edited by: master2007 on Mar 16, 2008 1:13 AM

  • Hi, how does one update the iPad A1219 to a 7? Ahhhhh is it possible?

    HI, how does one update an iPad Apple A1219 to a 7?

    No. it's not possible. The original iPad hit the wall at iOS 5.1.1. It can not run anything higher.

  • How does one update Std Table EDIPHONE(there is no Table Maintainance)?

    How does one update Std Table EDIPHONE(there is no Table Maintainance)?
    Regards,
    Shashank.

    You should not update the standard database table directly.
    through the partner profile tcode: WE20 you can update the table EDIPHONE.
    u can choose required partner profile in the WE20, select the tab 'Telephony', and update the data, the table EDIPHONE will get updated.
    if you want to maintain this edi phone data for a particular message type/s then select inbound/output parameters and double clikc on it, go to last tab in teh screen 'Telephony',  and updated the required data.

  • ROWID in update statment

    Hi all,
    Please advice if following statment will update correct rows?:
    for x in (select rowid from table where col=345 and col2=567 and col3=678)
    loop
    update table set col6=344 wher rowid=x.rowid;
    end loop;
    I just whant to be sure that refference to rowid column in update statment will update correct rows.
    Is the any cases when rowid value can be changed between fetching and updating?
    Thank you.

    You probably should make sure that you aren't updatind a record that has already been updated by checking that col6 <> 344 in both the guard at the beginning of the loop and in the update statement folowing the guard.
    LOOP
      -- check if still rows to update
      begin
         select 'x'
         into v_dummy
         from table
         where col1=345 and col2=567 and col3=678 and col6 <> 344
         and rownum = 1;
      exception
         when no_data_found then
            exit; -- leave loop
      end;
      update table
      set col6=344
      where col1=345 and col2=567 and col3=678 and col6 <> 344
      and rownum <= 50000; -- use big chucks to update
      commit;
    END LOOP;

  • How do i club these 2  update stmts into one update

    I got a situation like
    i want to update table T1 with 2 different flags 260,250
    for 2 different colums using a single update
    the conditions for these update r almost same but they differ by one condition
    which i mentioned below.please suggest some solution.
    update T1
    set exp_recal=260
    where exp_recal not in (250,261,262)
    and all other conditions r same
    update T1
    set estm_recal=250
    where estm_recal not in (261,262);
    and all conditions in r same as previous

    Instead of writing 2 update stmt, i thought we can use in a single update.will this t improve performance or it is best if we write update stmts separately.
    As the 2 updates r using the same conditions i thought it will improve performance
    if we write in one update.
    Thanks for your reply.
    Please suggest me which is good.

  • App store says there is one update but none need updating

    I just upgraded to Yosemite and under my Apple menu, the App Store shows there is one update needing to be done but when I open the App Store, it shows none need updating.
    This is a week-old MacBook Pro with 2.8Ghz i5, 8GB, and 512 SSD.

    Next time that happens while on WiFi, turn WiFi off in settings, wait about 30 seconds or so, then turn WiFi back on. Sometimes you have to do this two or three times, but this fixes that issue as well.

  • Updated success but still showing one update in setting

    Hello,
    In my iPhone 4s I upgraded to ios 8 successfully but still in my mobile showing there is one update from out side settings  but when  go and see in the
    setting--->general-->software update...> the software is up to date
    how to resolve this issue please any one help me on this.

    Most likely it is an update for your phone's OS. That is the one on settings.
    The 43 ones on the App Store are updates for the installed apps.
    What you need to do is to connect the phone on the internet and get the password for the apple id used to download the apps.

  • Hi pls give me any one update routine, transfer routine scenarios

    hi pls give me any one update routine, transfer routine scenarios for to telling interviews (easy scenario for interviews)

    Hi Venkat,
    Pls chk this nice paper:
    How To… Routines within Transformations
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
    Pls chk this links for samples & Examples:
    http://help.sap.com/saphelp_nw04s/helpdata/en/e3/732c42be6fde2ce10000000a1550b0/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/c3963dfbde4dede10000000a422035/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/bcdb7801344defe10000000a422035/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/bcdc6001344defe10000000a422035/frameset.htm
    Hope this helps,
    Regards
    CSM Reddy

Maybe you are looking for