Want to update multiple rows of the report but getting a bug.

hi,
I am trying to update multiple rows of a report.For that I have created a teport with dynamic checkbox generated using ---HTMLDB_ITEM.CHECKBOX(1,utt.trouble_ticket_id) " "----.Checkboxes are rendered perfectly on the report.
but when I tried to update the selected rows of the report as given in the documentation
begin
:P16_priority:=htmldb_application.G_F01.count;
for i in 1..htmldb_application.G_F01.count
loop
update umanage_trouble_ticket set severity =:P16_priority where
trouble_ticket_id = htmldb_application.G_F01(i);
end loop;     
end;
I found that all the rows are updated.not only selected rows.
and the count it gives =no of rows returned + no of rows selected.
Please help me regarding this.
thanx.
BHARAT

Hi Bernhard,
I think that u didnt get y problem.
When I take the value from "htmldb_application.g_f01(i)" then it should return id's of rows that are checked but when I do that it returns id's of all the rows.So I am not able to update only checked rows.
from id's of rows i mean value provided when generating checkboxes through query.
htmldb_item.checkbox(1,trouble_ticket_id) " "
I am approching to the solution as specified in the documentation. "Adding check boxes to each row in a report".
but still cant find any solution.
thanx that u showed some intrest in my problem.
If u can get the solution reply soon.
Regards
BHARAT

Similar Messages

  • My sister has a mac and i want to update my phone onto the computer but i dont want her to see all my stuff can you somehow have more than one itunes account on the same computer so my stuff with save?

    my sister has a mac and i want to update my phone onto the computer but i dont want her to see all my stuff can you somehow have more than one itunes account on the same macbook so my stuff with save?

    How to use multiple iPhone, iPad, or iPod devices with one computer. The only way is for you to have a separate user account to log into on that computer.

  • I have an IPhone 4,with IOS 4.2.6. I just got an iPad which has an IOS 5.1.1. I want to update my IOS on the phone but the computer I use no longer has Internet access. How can I update my phone? Also, what iTunes version should I have for the updated IOS

    I have an iPhone 4 with IOS 4.2.6. I recently received an iPad with IOS5.1.1. I want to update my IOS on my phone but the computer I use is no longer hooked up to the Internet. What do I need to do? Also, does my iTunes need to be updated? It is whatever was available last July. Thank you for your time and courtesy!

    To update your phone requires using the latest version of iTunes, on your computer, as well as Internet access. The update to iOS 5.0 or higher is an erase/restore deal, so you not only have to make sure all of the content, currently on your phone, is on your computer and accessible, you need to update iTunes first, have Internet access, then update your phone. There is no way around this fact. You could go to an Apple store or use another computer, but you run the risk of losing all of your data it you do that.

  • Update multiple rows in a dynamic table Dreamweaver CS5.5

    hello there
    i want to update multiple rows which comes from a dynamic table in Dreamweaver CS5 (a loop in php) here is my Mysql table :
    sql code
    CREATE TABLE `register`.`s_lessons` (
    `lid` int( 5 ) NOT NULL ,
    `sid` int( 9 ) NOT NULL ,
    `term` int( 5 ) NOT NULL ,
    `tid` int( 5 ) NOT NULL ,
    `point` double NOT NULL DEFAULT '0',
    PRIMARY KEY ( `lid` , `sid` , `term` ) ,
    KEY `tid` ( `tid` ) ,
    KEY `point` ( `point` )
    ) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_persian_ci;
    and this is my page source code:
    php file
    <?php require_once('../Connections/register.php'); ?>
    <?php
    session_start();
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $colname1_rs1 = "-1";
    if (isset($_GET['term'])) {
      $colname1_rs1 = $_GET['term'];
    $colname_rs1 = "-1";
    if (isset($_GET['lid'])) {
      $colname_rs1 = $_GET['lid'];
    $colname2_rs1 = "-1";
    if (isset($_SESSION['tid'])) {
      $colname2_rs1 = $_SESSION['tid'];
    mysql_select_db($database_register, $register);
    $query_rs1 = sprintf("SELECT s_lessons.sid, s_lessons.lid, s_lessons.term, s_lessons.tid, s_lessons.point FROM s_lessons WHERE s_lessons.lid = %s AND s_lessons.term = %s AND s_lessons.tid  = %s", GetSQLValueString($colname_rs1, "int"),GetSQLValueString($colname1_rs1, "int"),GetSQLValueString($colname2_rs1, "int"));
    $rs1 = mysql_query($query_rs1, $register) or die(mysql_error());
    $row_rs1 = mysql_fetch_assoc($rs1);
    $totalRows_rs1 = mysql_num_rows($rs1);
    $count=mysql_num_rows($rs1);
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    for ($j = 0, $len = count($_POST['lid']); $j < $len; $j++) {
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE s_lessons SET point=%s WHERE tid=%s, lid=%s, sid=%s, term=%s",
                           GetSQLValueString($_POST['point'] [$j], "double"),
                                GetSQLValueString($_SESSION['tid'], "int"),
                           GetSQLValueString($_POST['lid'] [$j], "int"),
                                GetSQLValueString($_POST['sid'] [$j], "int"),
                                GetSQLValueString($_POST['term'] [$j], "int"));
      mysql_select_db($database_register, $register);
      $Result1 = mysql_query($updateSQL, $register) or die(mysql_error());
      $updateGoTo = "student_lists.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>r</title>
    <link href="styles/style.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="styles/in_styles.css" rel="stylesheet" type="text/css" media="screen" />
    </head>
    <body>
    <div id="wrapper">
         <div id="header-wrapper">
         </div>
         <!-- end #header -->
         <div id="page">
              <div id="page-bgtop">
                   <div id="page-bgbtm">
                        <div id="content">
                             <div class="post">
                               <div style="clear: both;">
                            <form name="form1" id="form1" method="post" action="<?php echo $editFormAction; ?>">
                            <table border="1" align="center">
                              <tr>
                                <th>Student ID</th>
                                <th>Lesson ID</th>
                                <th>Semester</th>
                                <th>Point</th>
                              </tr>
                              <?php do { ?>
                                <tr>
                                  <td class="data"><label for="sid[]"></label>
                                  <input name="sid[]" type="text" id="sid[]" value="<?php echo $row_rs1['sid']; ?>" size="9" readonly="readonly" /></td>
                                  <td class="data"><label for="lid[]"></label>
                                  <input name="lid[]" type="text" id="lid[]" value="<?php echo $row_rs1['lid']; ?>" size="5" readonly="readonly" /></td>
                                  <td class="data"><label for="term[]"></label>
                                  <input name="term[]" type="text" id="term[]" value="<?php echo $row_rs1['term']; ?>" size="4" readonly="readonly" /></td>
                                  <td><label for="point[]"></label>
                                    <input name="point[]" type="text" id="point[]" value="<?php echo $row_rs1['point']; ?>" size="4" />                             
                              </tr>
                                <?php } while ($row_rs1 = mysql_fetch_assoc($rs1)); ?>
                            </table>
                            <p>
                              <input type="submit" name="Submit" id="Submit" value="Submit" />
                              <input type="hidden" name="MM_update" value="form1" />
                            </p>
                            </form>
                               </div>
                             </div>
                        <div style="clear: both;">
                    </div>
                        </div>
                        <!-- end #content -->
                        <!-- end #sidebar -->
                        <div style="clear: both;"> </div>
                   </div>
              </div>
         </div>
         <!-- end #page -->
    </div>
    <!-- end #footer -->
    </body>
    </html>
    <?php
    mysql_free_result($rs1);
    ?>
    All i want is that when users click on SUBMIT button values of point column in s_lessons(database table) be updated by new entries from user.
    i did my best and result with that code is :
    You  have an error in your SQL syntax; check the manual that corresponds to  your MySQL server version for the right syntax to use near ' lid=888,  sid=860935422, term=902' at line 1
    I would appreciate any idea.
    with prior thanks

    Go to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
    Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
    It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
    Regards
    Andrew Borg Cardona

  • Update Multiple Rows using Row Selector

    Hi,
    I want to update multiple rows using a tabular form with row selector, and an item in another region of the page, using an update expression and a button.
    The syntax would be like this:
    update MY_TABLE set UPDATABLE_COLUMN = :P10_NEW_VALUE where {row selector = true}
    What is the syntax for the WHERE clause, anyone knows? In the manual there is no information at all for doing this.
    PD. I added the row selector after creating the form, so I don't have any wizard-created MRU processes in the page.
    HTMLDB version is 1.6
    Thanks.

    Hi,
    I want to update multiple rows using a tabular form with row selector, and an item in another region of the page, using an update expression and a button.
    The syntax would be like this:
    update MY_TABLE set UPDATABLE_COLUMN = :P10_NEW_VALUE where {row selector = true}
    What is the syntax for the WHERE clause, anyone knows? In the manual there is no information at all for doing this.
    PD. I added the row selector after creating the form, so I don't have any wizard-created MRU processes in the page.
    HTMLDB version is 1.6
    Thanks.

  • Updating multiples rows in a trigger

    Hello All,
    I need to update multiple rows in a table based on some condition, do you have any ideas doing it?
    I know we can update single row using :NEW, but this time we need to update like 10 rows in a table.
    Thanks in advance for your reply.
    With Regards,
    SK
    CREATE OR REPLACE TRIGGER stsc.dfutoskuallocfactor_trig
    BEFORE UPDATE
    ON stsc.dfutosku
    FOR EACH ROW
    DECLARE
    v_dmdunit CHAR (30);
    v_dmdgroup CHAR (30);
    v_loc CHAR (30);
    BEGIN
    --dfutosku
    INSERT INTO igpmgr.dfutosku_upd_rec
    VALUES (:OLD.dmdunit, :OLD.dmdgroup, :OLD.dfuloc);
    --FOR rec IN (SELECT DISTINCT dmdunit, dmdgroup, dfuloc, eff, disc
    -- FROM stsc.dfutosku_upd_rec)
    --LOOP
    -- IF (rec.eff <> '01-Jan-1970' OR rec.eff >= SYSDATE)
    -- THEN
    -- DBMS_OUTPUT.put_line ('STAGE3 ' || ' ' || rec.eff);
    v_dmdunit := 'PLY 4-000';
    v_dmdgroup := 'TRD';
    v_loc := '48441';
    IF (v_dmdunit = 'PLY 4-000' AND v_dmdgroup = 'TRD' AND v_loc = '48441')
    THEN
    :NEW.udc_error := 1;
    END IF;
    --igpmgr.
    pkg_updateAllocfactor.allocfactor_update(o_return_code OUT NOCOPY PLS_INTEGER);
    --END IF;
    -- END LOOP;
    END;
    /

    also posted in
    {thread:id=1773210}
    Updating multiple rows of the same table in a trigger

  • I want to fill the rows of the report from the loop

    I want to fill the rows of the report from the loop
    For example, in forms
    cursor bdl is select code,decode(:global.user_lang,1,name,2,latin_name) name
    from GL_ANALYSISHDR
    begin
         go_block('bdls');
         clear_block;
         first_record;
         for rec in bdl loop
         :bdls.code:=rec.code;
         :bdls.name:=rec.name;
         next_record;
         end loop;
         go_block('bdls');
         first_record;
    end;
    I tried to use the REF CURSOR
    But it return the values in one time and does not allow me to conduct and control of

    Why do you need to do it by a curesor loop? Can't you put the query in the datamodel of the report and simply pass the parameter to restrict the query?

  • Report Template Help - Vertical report with multiple rows on the same line.

    I am tearing my hair out trying to figure a way to do this. I want a vertical report, but with the rows across the page rather than down it.
    e.g.
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5
    ROW1    ROW2    ROW3    ROW4   ROW5Has anyone managed to do this?

    Use a custom named column report template. The template could generate either:
    <li> a table with one physical <tt>tr</tt> row, with your "columns" being the logical "rows" of the report rendered as the <tt>td</tt>s within the row
    <li> a list of lists using CSS to render them side-by-side via <tt>float</tt> or <tt>inline-block</tt> (Some examples of similar techniques)

  • How to select multiple row in ALV report

    Hi friends,
    1. How to select multiple row in ALV report
                   ( How to set tab in ALV report and want to select multiple line.)
    Thanking you.
    Subash

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

  • I want to update multiple record in database which is based on condition

    hi all,
    I am using Jdev 11.1.2.1.0
    I have one table named(Pay_apply_det) in this table i want to update one column named(Hierarchy) every time and according to change i want to update or i want to maintain my log table named(pay_apply_appr).It based on level wise approval when the lowest person approve the record show on next level but if the second
    level person back it will be show only previous level hierarchy.And when the final approval happen the Posting_tag column of pay_apply_det will be updated too with hierarchy column.
    i have drag pay_apply_det's data control as a table in my .jsf page and add one column approve status in UI .in the approve status i used radio group which return A for approve B for back R for reject through value binding i make it get or set method in it baking bean.
    in backing bean class i have written code
        public void approveMethod(ActionEvent actionEvent) {
            ViewObject v9=new UtilClass().getView("PayApplyDetView1Iterator");
            int h5=0;
            Row rw9= v9.getCurrentRow();
            String x=(String) rw9.getAttribute("RemarkNew1");
            System.out.println(x);
            String z=getR2();
            System.out.println(z);
            if(( z.equals("R") || z.equals("B") )&& x==null)
                FacesMessage fm1 = new FacesMessage("Plz Insert Remark Feild");
                fm1.setSeverity(FacesMessage.SEVERITY_INFO);
                FacesContext context1 = FacesContext.getCurrentInstance();
                context1.addMessage(null, fm1);  
            else{
            ADFContext.getCurrent().getSessionScope().put("Radio",getR2().toString());
            String LogValue=(String)ADFContext.getCurrent().getSessionScope().get("logid");
            ViewObject voH=new UtilClass().getView("PayEmpTaskDeptView1Iterator"); 
            voH.setWhereClause("task_cd='449' and subtask_cd='01' and empcd='"+LogValue+"'");
            voH.executeQuery();
            Row row1= voH.first();
            int h1=(Integer)row1.getAttribute("Hierarchy");
              System.out.println("Login Person Hierarchy on save button press.."+h1);
            ViewObject vo9=new UtilClass().getView("PayApplyDetView1Iterator");
            Row row9= vo9.getCurrentRow();
            if(getR2().equals("A")&& h1!=1)
             row9.setAttribute ("ApprHier",h1);
                row9.setAttribute("IsClaimed","N");
                row9.setAttribute("ClaimedBy",null);
                row9.setAttribute("ClaimedOn", null);
            else if(getR2().equals("B") ) {
                ViewObject voO=new UtilClass().getView("LoHierViewObj1Iterator");
                voO.setNamedWhereClauseParam("QHVO", LogValue);
                Row rowO = voO.first();
               h5=(Integer)rowO.getAttribute("LPrehier");
                System.out.println("Back lower hier..."+h5);
                row9.setAttribute ("ApprHier",h5);
                row9.setAttribute("IsClaimed","N");
                row9.setAttribute("ClaimedBy",null);
                row9.setAttribute("ClaimedOn", null);
              else if((h1==1) &&(getR2().equals("A")) )
                      row9.setAttribute ("PostingTag","Y");
                      row9. setAttribute ("ApprHier", h1);
                        row9.setAttribute("IsClaimed","N");
                        row9.setAttribute("ClaimedBy",null);
                        row9.setAttribute("ClaimedOn", null);
              else if(getR2().equals("R"))
                row9.setAttribute ("ApprHier",-1);
                row9.setAttribute("IsClaimed","N");
                row9.setAttribute("ClaimedBy",null);
                row9.setAttribute("ClaimedOn", null);
            BindingContext BC=BindingContext.getCurrent();
            BindingContainer ac=BC.getCurrentBindingsEntry();
            OperationBinding ob=ac.getOperationBinding("Commit");
            ob.execute();
           vo9.executeQuery();
            FacesMessage fm = new FacesMessage("Your Data Successfully Commited..");
            fm.setSeverity(FacesMessage.SEVERITY_INFO);
            FacesContext context = FacesContext.getCurrentInstance();
            context.addMessage(null, fm);
        }here i put my approve status radio value in session variable because i also want to update my pay_apply_appr table which code i written in pay_apply_det IMPL class.
    Every thing is running well when i update single record but when i want to update multiple record then my current row only updated in pay_apply_det but log table( pay_apply_appr) created for all record.
    so is there any solution plz help me.
    thanks
    RAFAT

    Hi Rafat,
    If you are able to insert into, all you need to do is iterate through the rows. For this , before the first IF condition
    if(getR2().equals("A")&& h1!=1)Get the row count using int numRows =vo9.getRowCount(); , and then write it before the IF condition
    if (int i=0;i<numRows;i++} After
    row9.setAttribute("ClaimedOn", null);
            }write vo9.next(); to iterate to next row,
    Hope this will work.
    Nigel.

  • Update multiple row for different values

    hi,
    Please provide me the sql query to update multiple row in a table with different values.
    i need to change the old date to new date
    we have only 3 column id,name,old date.now i need to update the old date to new date
    ID name old date new date
    1 A 2012-12-20 12/7/2012
    2 B 2012-12-20 12/9/2012
    3 c 2012-12-20 12/5/2012
    thank you.

    Here are two ways to do this. Thanks to ranit for the table creation script, which I adapted.create table test_x
    as
    select 1 id, 'A' name, to_date('2012-12-20','yyyy-mm-dd') old_date
    from dual UNION ALL
    select 2 id, 'B' name, to_date('2012-12-20','yyyy-mm-dd') old_date
    from dual UNION ALL
    SELECT 3 ID, 'C' NAME, TO_DATE('2012-12-20','yyyy-mm-dd') OLD_DATE
    from dual;First method using MERGE:MERGE INTO TEST_X O
    USING (
      select 1 id, to_date('12/7/2012','mm/dd/yyyy') new_date
      from dual UNION ALL
      select 2 id, to_date('12/9/2012','mm/dd/yyyy') new_date
      from dual UNION ALL
      SELECT 3 ID, TO_DATE('12/5/2012','mm/dd/yyyy') NEW_DATE
      FROM DUAL
    ) n
    ON (O.ID = N.ID)
    WHEN MATCHED THEN UPDATE SET OLD_DATE = n.NEW_DATE;Second method using UPDATE:UPDATE TEST_X SET OLD_DATE =
      CASE WHEN ID = 1 THEN TO_DATE('12/7/2012','mm/dd/yyyy')
           WHEN ID = 2 THEN TO_DATE('12/9/2012','mm/dd/yyyy')
           WHEN ID = 3 THEN TO_DATE('12/5/2012','mm/dd/yyyy')
      END
    where id between 1 and 3;
    You probably don't want to use these methods.*
    You say the "user" will enter these values. Will he always enter exactly 3 values?
    The "user" will enter values into a screen I suppose. What language is the user interface programmed in?

  • Updating multiple rows in a table in ADF

    Hi
    How do we update multiple rows in a table.
    Onclicking a update button the changed rows must be updated.

    Hi Prince,
    currently I am selecting one row from the table and rendering a region at the top of the table and capturing the user entered data with the following code:
    ViewObjectVOImpl vo = getViewObjectVO1();
    Row CurrentRow = vo.getCurrentRow();
    //After this I perform the checks like user entered value is not null or check input as per business logic.
    if(CurrentRow.getAttribute("attributeName") ==null){
    //Add what message you want to display
    //Add other business logic.
    After making all the checks, i commit it.
    getOADBTransaction().commit();
    Now in my new page I am capturing the user input in the table itself like an excel sheet. Suppose there are ten rows in my advanced table on my page, and each row has one editable field. I have one save button at the bottom of the table.
    Now on clicking the save button I have to capture the user input, check whether there is any null value and if all the entered data is correct then only I should commit it.
    Can you please let me know how we can accomplish that.
    Regards
    Hawker

  • Trouble updating multiple rows in table using subquery

    Hi everyone, I'm having trouble updating multiple rows with a subquery. Here's the setup:
    create table mytable (
    col_a number primary key,
    col_b number,
    col_c number,
    col_d number);
    insert into mytable values (1 ,1,1,15);
    insert into mytable values (2 ,1,2,7 );
    insert into mytable values (3 ,1,3,11);
    insert into mytable values (4 ,1,4,23);
    insert into mytable values (5 ,1,5,14);
    insert into mytable values (6 ,2,1,50);
    insert into mytable values (7 ,2,2,41);
    insert into mytable values (8 ,2,3,13);
    insert into mytable values (9 ,2,4,12);
    insert into mytable values (10,2,5,19);
    insert into mytable values (11,3,1,10);
    insert into mytable values (12,3,2,92);
    insert into mytable values (13,3,3,81);
    insert into mytable values (14,3,4,17);
    insert into mytable values (15,3,5,66);
    insert into mytable values (16,4,1,54);
    insert into mytable values (17,4,2,41);
    insert into mytable values (18,4,3,22);
    insert into mytable values (19,4,4,24);
    insert into mytable values (20,4,5,17);For this example, using an update statement (or merge if that's better), say I want to set the values for col_d where col_b = 3 equal to the values for col_d where col_b = 1 and col_c equal each other. Results should look like the following after the update:
    col_a col_b col_c col_d
    1     1     1     15
    2     1     2     7
    3     1     3     11
    4     1     4     23
    5     1     5     14
    6     2     1     50
    7     2     2     41
    8     2     3     13
    9     2     4     12
    10    2     5     19
    11    3     1     15
    12    3     2     7
    13    3     3     11
    14    3     4     23
    15    3     5     14
    16    4     1     54
    17    4     2     41
    18    4     3     22
    19    4     4     24
    20    4     5     17I can see it right there at my fingertips using this query, where I want to set b_col_d = a_col_d, but I'm missing something, as this query returns too many rows when used in the update statement.
    select * from (
      select col_a as a_col_a, col_b as a_col_b, col_c as a_col_c, col_d as a_col_d
      from mytable
      where col_b = 1
      ) a, (
      select col_a as b_col_a, col_b as b_col_b, col_c as b_col_c, col_d as b_col_d
      from mytable
      where col_b = 3
      ) b
    where a.a_col_c = b.b_col_cupdate mytable set column_d = (select ??? where exists ???)
    Can someone help me get there? I'm using 10GR2.
    Thanks!
    Mark

    Hopefully this is what you are looking for:
    SQL > UPDATE mytable myt1
      2  SET    col_d = ( SELECT myt2.col_d
      3                   FROM   mytable myt2
      4                   WHERE  myt2.col_b = 1
      5                   AND    myt1.col_c = myt2.col_c
      6                 )
      7  WHERE  col_b = 3
      8  AND    EXISTS
      9         ( SELECT NULL
    10           FROM   mytable myt2
    11           WHERE  myt2.col_c = myt1.col_c
    12         )
    13  ;
    5 rows updated.
    SQL > SELECT * FROM mytable ORDER BY col_a;
                   COL_A                COL_B                COL_C                COL_D
                       1                    1                    1                   15
                       2                    1                    2                    7
                       3                    1                    3                   11
                       4                    1                    4                   23
                       5                    1                    5                   14
                       6                    2                    1                   50
                       7                    2                    2                   41
                       8                    2                    3                   13
                       9                    2                    4                   12
                      10                    2                    5                   19
                      11                    3                    1                   15
                      12                    3                    2                    7
                      13                    3                    3                   11
                      14                    3                    4                   23
                      15                    3                    5                   14
                      16                    4                    1                   54
                      17                    4                    2                   41
                      18                    4                    3                   22
                      19                    4                    4                   24
                      20                    4                    5                   17
    20 rows selected.Thank you so much for providing the sample data in an easy to consume form, as well as the expected output.

  • CMP update multiple rows

    Hi,
    Is there a way to update multiple rows when using CMPs.
    For example I can update multiple rows by this method.
    while (condition)
    cmp = cmpHome.findByPrimaryKey(key);
    cmp.setValue(newValue);
    Rather than this method is there a way that I can update many rows just as normal sql update.
    thanks in advance,
    chamal.

    If you want to concatenate Acol column with sysdate for 605 and 608 ....i think you need to code less (of what you have posted)
    UPDATE TEST
    SET TEST.ACOL =  TEST.ACOL || ' ' ||sysdate
    where
    test.acol in (605,608);--I don't know why you want this , Just given the suggestion as per the requirement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to update multiple records in the table using POST parameters:

    i got this idea from this website:http://www.karlrixon.co.uk/articles/sql/update-multiple-rows-with-different-values-and-a-s ingle-sql-query/comment-page-1/#comment-5409. Basically i am trying to update all the status in the results page, and by adding $i in front of the id in the text fields, and checkboxes, i can name the different inputs with different names:
    The image of how it takes the inputs is shown here:http://forums.adobe.com/thread/709034?tstart=0
    I tried this but got this error:Parse error: syntax error, unexpected T_IF, expecting ')' in C:\xampp\htdocs\Database Query\results_change.php on line 51
    will not work in the update code section:
    for($i=0;$i<$maxRows_Recordset1;$i++)
    {$a=sprintf("%s",GetSQLValueString($_POST['changeid $i'],"int"));
    $b=sprintf("%s",GetSQLValueString($_POST['checkbox $i'],"text"));
    $display_order .= array(
        $a => $b
    if($i<$maxRows_Recordset1-1)
    $ids = implode(',', array_keys($display_order));
    $updateSQL = "UPDATE `change` SET Status = CASE Change_id ";
    foreach ($display_order as $a => $b) {
        $updateSQL .= sprintf("WHEN %d THEN %s ", $a,$b);
    $updateSQL .= sprintf("END WHERE `Change_id` IN ($ids)");

    Hi,
    Try
    BEGIN
      FOR i IN 1..APEX_APPLICATION.G_F03.COUNT LOOP
        UPDATE xx_test
        SET checkbox = 'Y'
        WHERE rec_no = APEX_APPLICATION.G_F03(i);
      END LOOP;
    END;Code loops all checked checkbox. You do not need commit on page process.
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

Maybe you are looking for