Update multiple records with PHP

Hey,.

I want to update multiple lines with a single click on the submit button.

Unfortunately, it does not work. What's not in the code?

<? php require_once('.. / Connections/ikon.php');? >
<? PHP
If (! function_exists ("GetSQLValueString")) {}
function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
If (via 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 "set":
$theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;
break;
}
Return $theValue;
}
}

$editFormAction = $_SERVER ['PHP_SELF'];
If (isset {}

$editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);
}

for ($j = 0, $len = count($_POST['id']); $j < $len; $j ++) {}
If ((isset($_POST["MM_update"])) & & ($_POST ["MM_update"] == "openingsuren_wijzigen")) {}
$updateSQL = sprintf ("UPDATE ikon_openingsuren SET dag = %s voormiddag = %s, namiddag = WHERE id = %s %s",
GetSQLValueString ($_POST ['dag'] [$j], "text").
GetSQLValueString ($_POST ['voormiddag'] [$j], "text").
GetSQLValueString ($_POST ['namiddag'] [$j], "text").
GetSQLValueString ($_POST ['id'] [$j], "int"));

@mysql_select_db ($database_ikon, $ikon);
$Result1 = mysql_query ($updateSQL, $ikon) or die (mysql_error ());
}
}

@mysql_select_db ($database_ikon, $ikon);
$query_rsWijzigOpeningsuren = "SELECT * from ikon_openingsuren";
$rsWijzigOpeningsuren = mysql_query ($query_rsWijzigOpeningsuren, $ikon) or die (mysql_error ());
$row_rsWijzigOpeningsuren = mysql_fetch_assoc ($rsWijzigOpeningsuren);
$totalRows_rsWijzigOpeningsuren = mysql_num_rows ($rsWijzigOpeningsuren);
? >


<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > ""
"< html xmlns ="http://www.w3.org/1999/xhtml">".
< head >
< meta http-equiv = "content-type" content = text/html"; charset = utf-8 "/ >"
< title > < / title >
< / head >
< body >
< form action = "<?" PHP echo $editFormAction;? ">" method = "POST" name = "openingsuren_wijzigen" id = "openingsuren_wijzigen" >
< input name = "id []" type = "hidden" id = "id" value = "<?" PHP echo $row_rsWijzigOpeningsuren ['id'];? ">" / >
< table id = "tbl_openingsuren" >
< thead >
< b >
< scope = "col" th > Dag < /th >
< scope = "col" th > Voormiddag < /th >
< scope = "col" th > Namiddag en Avond < /th >
< /tr >
< / thead >
< tbody >
<? PHP {? >}
< b >

< td > < input name = "dag []" type = "text" id = "dag" value = "<?" PHP echo $row_rsWijzigOpeningsuren ['dag'];? ">" size = "15" maxlength = "15" / > < table >
< td > < input name = "[to] voormiddag" type = "text" id = "voormiddag" value = "<?" PHP echo $row_rsWijzigOpeningsuren ["voormiddag"];? ">" size = "15" maxlength = "15" / > < table >
< td > < input name = "[of] namiddag" type = "text" id = "namiddag" value = "<?" PHP echo $row_rsWijzigOpeningsuren ["namiddag'];? ">" size = "15" maxlength = "15" / > < table >
< /tr >
<? PHP} while ($row_rsWijzigOpeningsuren = mysql_fetch_assoc ($rsWijzigOpeningsuren));? >
< / tbody >
< /table >
< p > < input type = "submit" name = "submit" id = "submit" value = "Stayed" class = "knop" / > < / p >
< input type = "hidden" name = "MM_update" value = "openingsuren_wijzigen" / >
< / make >
< / body >
< / html >
<? PHP
mysql_free_result ($rsWijzigOpeningsuren);
? >

Powerlait wrote:

I want to update multiple lines with a single click on the submit button.

Unfortunately, it does not work. What's not in the code?

It would be more useful if you were to say what is happening. "It doesn't work" is not very useful.

However, a quick look at your code is your hidden field that contains the ID outside the loop (repeat region) in your form. Place it inside the loop like this:



   
   
   




Tags: Dreamweaver

Similar Questions

  • Update multiple records with one submit?

    For the life of me I can't figure out how to do this. I have boxes with the ID primary key listed as the value of a repeat region. I want to perform an update on 2 columns for all checked IDs.

    CODE SUDEO

    < form >

    < cfoutput query...

    other textfields...

    < input name = "checkbox" type = "checkbox" id = "checkbox" value = "" #table.id # "/ >"

    < / cfoutput >

    SUBMIT BUTTON

    < / make >

    My update statement:


    UPDATE table
    SET 1 = Column1, column2 = 'whatever '.
    WHERE id IN (< cfqueryparam cfsqltype = "cf_sql_integer" value = "#TRIM (FORM.checkbox) #" >)
    < / cfquery >

    It updates only if I check a box has no effect when more than one is selected.

    I also tried a loop during the update statement, but nothing seems to work.

    You must use the cfqueryparam list attribute.

  • DB update multiple records in a table with a form

    I'm developing an online proofing system that displays a number of images and then allow the client to approve each image, but also to comment.

    I currently have a configuration table with the different elements (an image dynamically takes its name, details about the image and the required form fields). See this Image for layout

    I would then apply a repeat region (the number of signs vary) and you want to update all records with feedback from the customer and approval with a single form. How this is done? I downloaded a trial of the Toolbox for developers, but the documentation is horrible. I'd be willing to buy an extension that will allow, as appropriate.

    I found an extension that does this in two minutes:

    http://www.WebAssist.com/Professional/products/ProductDetails.asp?pid=117

    Great software, highly recommended. Easy to figure out and got this "problem" solved quickly.

  • Update multiple records at once

    First, thank you very much the people who have helped me out several times now. I put things together and came across another issue of 'beauty' begin as follows. In the previous topics, I had a way to get to an array of automated classification based on the inputs of a fixtures table and some simple calculations. Now, which has been accomplished which resulted in me having to update all the teams by simply clicking a button.

    As you can see in the code below, using a table with every row a form, at the end of the line, there is a button called 'OK' I have to push to update the record according to. A repeat region for all teams in this query shows the ranking of 'new', but is not yet inserted in the League table. Is it possible to have this repeat region without having to push 18 or 20 times a button update? At the end of the table, one (1) button update all records? The primary key is composed like this ' 0000 - u00a "(4 numéros un tiret puis un «u» 1 ou 2 numéros et 1 ou 2 lettres à nouveau)."

    <?php require_once('Connections/connection.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
      $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;
    }
    }

    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }

    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "klassement")) {
      $updateSQL = sprintf("UPDATE klassement SET wedstrijden=%s, overwinning=%s, verlies=%s, gelijkspel=%s, goalsvoor=%s, goalstegen=%s, goalverschil=%s, punten=%s WHERE ploegid=%s",
                           GetSQLValueString($_POST['wedstrijden'], "int"),
                           GetSQLValueString($_POST['overwinning'], "int"),
                           GetSQLValueString($_POST['verlies'], "int"),
                           GetSQLValueString($_POST['gelijkspel'], "int"),
                           GetSQLValueString($_POST['goalsvoor'], "int"),
                           GetSQLValueString($_POST['goalstegen'], "int"),
                           GetSQLValueString($_POST['goalverschil'], "int"),
                           GetSQLValueString($_POST['punten'], "int"),
                           GetSQLValueString($_POST['ploegid'], "text"));

      mysql_select_db($database_koscw, $koscw);
      $Result1 = mysql_query($updateSQL, $koscw) or die(mysql_error());

      $updateGoTo = "klassement-ploegen.php?reeksid=" . $row_klassement['reeksid'] . "";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $updateGoTo));
    }

    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;
    }
    }

    $reeks_klassement = "-1";
    if (isset($_GET['reeksid'])) {
      $reeks_klassement = $_GET['reeksid'];
    }
    mysql_select_db($database_koscw, $koscw);
    $query_klassement = sprintf("select * from klassement where reeksid = %s order by status asc, punten desc, overwinning desc, goalverschil desc", GetSQLValueString($reeks_klassement, "text"));
    $klassement = mysql_query($query_klassement, $koscw) or die(mysql_error());
    $row_klassement = mysql_fetch_assoc($klassement);
    $totalRows_klassement = mysql_num_rows($klassement);

    $id_reeks = "-1";
    if (isset($_GET['reeksid'])) {
      $id_reeks = $_GET['reeksid'];
    }
    mysql_select_db($database_koscw, $koscw);
    $query_reeks = sprintf("select reeksnaam from reeksen where reeksid = %s", GetSQLValueString($id_reeks, "text"));
    $reeks = mysql_query($query_reeks, $koscw) or die(mysql_error());
    $row_reeks = mysql_fetch_assoc($reeks);
    $totalRows_reeks = mysql_num_rows($reeks);

    mysql_select_db($database_koscw, $koscw);
    $query_seizoen = "select * from seizoen";
    $seizoen = mysql_query($query_seizoen, $koscw) or die(mysql_error());
    $row_seizoen = mysql_fetch_assoc($seizoen);
    $totalRows_seizoen = mysql_num_rows($seizoen);

    $huidig=$row_seizoen['huidigseizoen'];
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" type="text/css" media="all" href="../_styles/koscw-admin.css" />
    <title>Klassement <?php echo $row_reeks['reeksnaam']; ?> | Beheerpaneel | 1349</title>
    </head>
    <body>
    <div id="container">
    <h1 class="overzichth1">Klassement <?php echo $row_reeks['reeksnaam']; ?></h1>
    <?php if ($totalRows_klassement > 0) { // Show if recordset not empty ?>
    <table cellpadding="5" cellspacing="0" border="0" id="klassement">
    <tr>
      <td class="klassementsmall bgccc bold"></td>
           <td class="klassementteam bgccc bold">Ploegnaam</td>
           <td class="klassementsmall bgccc bold">+</td>
           <td class="klassementsmall bgccc bold">-</td>
           <td class="klassementsmall bgccc bold">=</td>
          <td class="klassementsmall bgccc bold">#</td>
           <td class="klassementsmall bgccc bold"><img src="../_img/goalsmade.png" alt="Goals +" /></td>
           <td class="klassementsmall bgccc bold"><img src="../_img/goalsagainst.png" alt="Goals -" /></td>
           <td class="klassementsmall bgccc bold"><img src="../_img/goalsdifference.png" alt="Goals &asymp;" /></td>
           <td class="klassementsmall bgccc bold">PTN</td>
          <td class="klassementsmall bgccc"> </td>
    </tr>
    <?php
    $i=0;
    do {
    $i++;
    if($i % 2) { //this means if there is a remainder
         echo "<tr class=\"calendareven\">";
    } else { //if there isn't a remainder we will do the else
         echo "<tr class=\"calendarodd\">";
    }
    ?>
    <td>
    <?php
    $rank += 1;
    echo $rank;
    ?>      </td>
           <td class="klassementteam">
              <?php
            $thuisploeg=$row_klassement ['ploegid'];
              $sql_select_thuisploeg="select ploegnaam from ploegen where ploegid = ('$thuisploeg')";
              $resultset_thuisploeg=mysql_query($sql_select_thuisploeg);
              while ($data_thuisploeg=mysql_fetch_array($resultset_thuisploeg))
              {echo $data_thuisploeg['ploegnaam'] . " ";}?></td>
           <form action="<?php echo $editFormAction; ?>" method="POST" name="klassement">
          <input type="hidden" name="ploegid" value="<?php echo $row_klassement ['ploegid']; ?>" />
           <td>
          <?php
           $tw=$row_klassement['ploegid'];
           $sql_select_tw="SELECT COUNT( * ) AS twin FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND thuisploegid = '$tw' AND thuisploeggoals > bezoekersgoals";
           $resultset_tw=mysql_query($sql_select_tw);
           $data_tw=mysql_fetch_array($resultset_tw);
           $data_tw['twin'];
          
           $uitwin=$row_klassement['ploegid'];
           $sql_select_uitwin="SELECT COUNT( * ) AS awin FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND bezoekersid = '$uitwin' AND thuisploeggoals < bezoekersgoals";
           $resultset_uitwin=mysql_query($sql_select_uitwin);
           $data_uitwin=mysql_fetch_array($resultset_uitwin);
           $data_uitwin['awin'];
          
           $win=($data_tw['twin'])+($data_uitwin['awin']);
           ?>
          <input type="text" name="overwinning" value="<?php echo $win; ?>" class="inputscore" readonly="readonly" />
          </td>
           <td>
          <?php
           $tv=$row_klassement['ploegid'];
           $sql_select_tv="SELECT COUNT( * ) AS tver FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND thuisploegid = '$tv' AND thuisploeggoals < bezoekersgoals";
           $resultset_tv=mysql_query($sql_select_tv);
           $data_tv=mysql_fetch_array($resultset_tv);
           $data_tv['tver'];
          
           $uitverlies=$row_klassement['ploegid'];
           $sql_select_uitverlies="SELECT COUNT( * ) AS aver FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND bezoekersid = '$uitverlies' AND thuisploeggoals > bezoekersgoals";
           $resultset_uitverlies=mysql_query($sql_select_uitverlies);
           $data_uitverlies=mysql_fetch_array($resultset_uitverlies);
           $data_uitverlies['aver'];
          
           $ver=($data_tv['tver'])+($data_uitverlies['aver']);
           ?>
          <input type="text" name="verlies" value="<?php echo $ver; ?>" class="inputscore" readonly="readonly" />
          </td>
           <td>
          <?php
           $thuisdraw=$row_klassement['ploegid'];
           $sql_select_thuisdraw="SELECT COUNT( * ) AS tdraw FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND thuisploegid = '$thuisdraw' AND thuisploeggoals = bezoekersgoals";
           $resultset_thuisdraw=mysql_query($sql_select_thuisdraw);
           $data_thuisdraw=mysql_fetch_array($resultset_thuisdraw);
           $data_thuisdraw['tdraw'];
          
           $awaydraw=$row_klassement['ploegid'];
           $sql_select_awaydraw="SELECT COUNT( * ) AS adraw FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND bezoekersid = '$awaydraw' AND thuisploeggoals = bezoekersgoals";
           $resultset_awaydraw=mysql_query($sql_select_awaydraw);
           $data_awaydraw=mysql_fetch_array($resultset_awaydraw);
           $data_awaydraw['adraw'];
          
           $draw=($data_thuisdraw['tdraw'])+($data_awaydraw['adraw']);
           ?>
          <input type="text" name="gelijkspel" value="<?php echo $draw ?>" class="inputscore" readonly="readonly" />
          </td>
          <td>
          <?php $wedstrijden=$win+$ver+$draw; ?>
          <input type="text" name="wedstrijden" value="<?php echo $wedstrijden; ?>" class="inputscore" readonly="readonly" />
          </td>
           <td>
           <?php
          $tgv=$row_klassement ['ploegid'];
           $sql_select_tgv="SELECT SUM( thuisploeggoals ) AS tgv1 FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND thuisploegid = '$tgv'";
           $resultset_tgv=mysql_query($sql_select_tgv);
           $data_tgv=mysql_fetch_array($resultset_tgv);
           $data_tgv['tgv1'];

          $ugv=$row_klassement ['ploegid'];
           $sql_select_ugv="SELECT SUM( bezoekersgoals ) AS ugv1 FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND bezoekersid = '$ugv'";
           $resultset_ugv=mysql_query($sql_select_ugv);
           $data_ugv=mysql_fetch_array($resultset_ugv);
           $data_ugv['ugv1'];

           $gv=($data_tgv['tgv1'])+($data_ugv['ugv1']);
           ?>
          <input type="text" name="goalsvoor" value="<?php echo $gv; ?>" class="inputscore" readonly="readonly" />
          </td>
           <td>
           <?php
          $tgt=$row_klassement ['ploegid'];
           $sql_select_tgt="SELECT SUM( thuisploeggoals ) AS tgt1 FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND bezoekersid = '$tgv'";
           $resultset_tgt=mysql_query($sql_select_tgt);
           $data_tgt=mysql_fetch_array($resultset_tgt);
           $data_tgt['tgt1'];

          $ugt=$row_klassement ['ploegid'];
           $sql_select_ugt="SELECT SUM( bezoekersgoals ) AS ugt1 FROM kalender WHERE seizoen = '$huidig' AND speeldag !=0 AND thuisploegid = '$ugv'";
           $resultset_ugt=mysql_query($sql_select_ugt);
           $data_ugt=mysql_fetch_array($resultset_ugt);
           $data_ugt['ugt1'];

           $gt=($data_tgt['tgt1'])+($data_ugt['ugt1']);
           ?>     
          <input type="text" name="goalstegen" value="<?php echo $gt; ?>" class="inputscore" readonly="readonly" />
          </td>
           <td>
           <?php $goals=$gv-$gt; ?>
          <input type="text" name="goalverschil" value="<?php echo $goals; ?>" class="inputscore" readonly="readonly" />
          </td>
           <td>
           <?php $punten=($win*3)+($draw*1); ?>
          <input type="text" name="punten" value="<?php echo $punten; ?>" class="inputscore" readonly="readonly" />
          </td>
          <td>
          <input type="submit" value="OK" />
          </td>
          <input type="hidden" name="MM_update" value="klassement" />
           </form>
      </tr>
      <?php } while ($row_klassement = mysql_fetch_assoc($klassement)); ?>
    </table>
    <?php } // Show if recordset not empty ?>

    </div>
    </body>
    </html>
    <?php
    mysql_free_result($klassement);

    mysql_free_result($reeks);

    mysql_free_result($seizoen);
    ?>

    Each record is separated, as well as a record can be updated at once, unless you want that all records have the same value.

    To update multiple records in a single operation, you must send the form tabular data. You do this by adding an empty pair of brackets at the end of the name attribute of each entry on the form like this:

     
    

    This translates by $_POST ['ploegid'] which contains a table of all IDS: $_POST ['ploegid'] [0], $_POST ['ploegid'] [1], $_POST ['ploegid'] [2] and so on. All the attributes of the repeat region name need to have added hooks. The following hidden field should be outside of the repeat region and may not have the brackets:

    
    

    You can then use a loop for updating the values like this:

    for ($j = 0, $len = count($_POST['ploegid']); $j < $len; $j++) {  $updateSQL = sprintf("UPDATE klassement SET wedstrijden=%s, overwinning=%s,   verlies=%s, gelijkspel=%s, goalsvoor=%s, goalstegen=%s, goalverschil=%s,   punten=%s WHERE ploegid=%s",                       GetSQLValueString($_POST['wedstrijden'][$j], "int"),                       GetSQLValueString($_POST['overwinning'][$j], "int"),                       GetSQLValueString($_POST['verlies'][$j], "int"),                       GetSQLValueString($_POST['gelijkspel'][$j], "int"),                       GetSQLValueString($_POST['goalsvoor'][$j], "int"),                       GetSQLValueString($_POST['goalstegen'][$j], "int"),                       GetSQLValueString($_POST['goalverschil'][$j], "int"),                       GetSQLValueString($_POST['punten'][$j], "int"),                       GetSQLValueString($_POST['ploegid'][$j], "text"));
    
      mysql_select_db($database_koscw, $koscw);  $Result1 = mysql_query($updateSQL, $koscw) or die(mysql_error());}
    
  • Update a record with a selection box

    I have a database table called "currentTOW" that contains a single record with only an 'ID' field and a field 'owner '. I have a second table called "truckofweek" that contains several fields with multiple records, including one called 'owner '.

    I want to change my page, setCurrentTOW.cfm, to use a 'truckofweek' query to populate a drop-down list select menu update check in "currentTOW" instead of a regular supply.

    I need the list to contain the strings in the 'Owner' of the 'truckofweek' table fields and then update the table "currentTOW" with the selected channel. How can I do this? The following code fills an area of selection very well, but will not update.

    > I have a database table called "currentTOW" that contains a record
    > with only an 'ID' field and a field 'owner '.
    >..
    > I don't really know what I want to say right here.

    CFUPDATE throws an error because he expects a field named 'ID' (the primary key of the table). This field is never passed to the action because of the cfif statement page in your form code. The said cfif "only create the hidden field when URL.ID is not equal to 0". Given that URL.ID is equal to zero the hidden field is never created.




    I would also change the "currentTOW" table to store the primary key of the table "truckofweek" instead of the name of 'owner '.

  • How to update multiple records

    Hello

    I have this problem

    I have this table whith 100,000 records with the State of the column = DONE

    NUM_CUSTSTATUSDATE
    00931754FACT05/05/2015-00:00:00
    00931741FACT05/05/2015-00:00:00
    00931742FACT05/05/2015-00:00:00
    00931744FACT05/05/2015-00:00:00
    00931743FACT05/05/2015-00:00:00
    00931747FACT05/05/2015-00:00:00
    00931746FACT05/05/2015-00:00:00

    I need to update the State of the column with values from another table

    AU_NUM_CUSTAU_DATEAU_STATUS
    0093175405/05/2015-00:00:00FACT
    0093174105/05/2015-00:00:00DELETE
    0093174205/05/2015-00:00:00DELETE
    0093174405/05/2015-00:00:00DELETE
    0093174305/05/2015-00:00:00DELETE
    0093174705/05/2015-00:00:00DELETE
    0093174605/05/2015-00:00:00DELETE

    Thanks if you can help

    Hello

    You can use the merge sql stmt:

    merge into target_table t

    using s source_table

    on (t.num_cust = s.au_num_cust and = t.date s.au_date)

    When matched then

    update set s.au_status = t.status

    Greetings,

    SIM

  • How update multiple records at once?

    Hi all

    I'm using oracle 11g 1.2.1.0.

    I have table below

    emp_id, emp_name

    1                     X

    2                      Y

    3                      Z

    4                     M

    5                      Q

    ..                   ..

    .                     ...

    ..                    ....

    as I have 10 records and emp_id is unique

    I have an added email column more

    Now I want to update e-mail as a column as [email protected] [email protected] ... [email protected] .

    I created the sequence to concatenate the x and gamil.com.

    But how I will update to the atime all records with the e-mail data.

    Concerning

    Dale

    Or

    as you said that you have created a query sequence will look like:

    Update emp

    the value email = 'x '. seq_name.nextval | ' @gmail.com';

    In general, if you want to update all rows in a table do not put a clause where clause, even if I avoid using these updates its place to the user to use them or not.

    Cheerz,

    Stako

  • Last LR update multiple problems with the Canon CR2 files

    Hi team

    I need to let you know about a problem of GUI which is performing production and publishing workflows using LR after the last update of the main users.

    First LR kept crashing with Nikon nef import, it was more come with updated check & update, however the files seem to be flaky, sometimes more than 5 minutes to make the 1 / 1 or 100%, that using a MacBook Pro with the Retina display that normally does in less than a second because of the acceleration of the graphics card shows me that there must be a bug.

    You can check your code against the latest OS from Apple, as it has also been updated last week, I noticed that the preview opening on RAW with the Apple OS is slower, so it could be Apple, if you use their codecs.

    Second, I use both Nikon, Canon and Fuji Photo in RAW, The Cannon is having major issues that basically stop me to be able to make adjustments, incorrect proportions basically each function seems to pile up and stoppage of work of LR, I optimized and revived, all work on the other PC files that haven't been updated. I also noticed that when I select 6 or 8 to indicate color flags keeps the last notification of action on the screen.

    Can analyze you.

    Camera model: EOS 7 d CR2

    An example of this is that if I select the GREEN labels bar image does not reduce to show only the GREENS.

    Example 1.jpg

    Hi team

    Another updated. I solved my LR 15.2.1 problems and seems to work fine now.

    Advice for anyone with GUI main questions LR 15.2.1 running on Apple MacBook Pro retina edition 2013 with Apple El Capitan in what concerns the CR2 files. The symptoms started after the upgrade of 15.2 CC.

    OS X Symptoms: Finder related - if you have slow full resolution display in the finder, it is to say select a RAW (not jpeg) image & press SPACEBAR to preview image, if the image is about 15 to 25 MB & if it takes more than 20-30 seconds to load the full resolution with excellent clarity or you get the Gables of rendering then it's maybe that your library caches are chocked.

    Symptoms of Adobe LR: LR 15.2.1 - GUI does not, collage, inadmissible on files CR2 once the file cache has been read or changes.

    Depending on how clean your machine is ie Contact AppleCare to help you to clear the data in System & User Library Cache, then perform a HDD of first aid with OS X Utilities.

    Restart your computer, and then try again, the Finder preview my now taken 10-15 seconds to make it complete, which is normal for such a large file. Also somehow clean the cache has significantly improved the LR15.2.1 as well.

    Regarding LR 15.2.1 CR2 files read better again, and I can see updates in near real-time. Watch also the son for GPU issues performance as well, as I mine off, restarted LR & closed completely to the bottom of the laptop and rebooted again allowing the GPU box and who can to help also.

    As a result of slower Finder preview rendering, to solve this problem, I can re - install El Capitan to still solve my problems if I want, however I decided of don't not at this point, simply because of the risk & maybe needing a full hard reinstall, which mean the loss of data, and I don't want that, without making a backup first. I am happy to continue to work as it is until I had time to backup and make the full re-install, what I'll do in my local AppleStore...

    Sorry not clearly answer my own resolution or steps to follow, but one or more of them have seriously helped me today... so I hope this helps others too facing the same or similar issue

  • Problems updating multiple columns with a TO... SELECT subquery

    Hello

    This statement works very well:

    UPDATE scott.dept
    SET (deptno) = (WITH AS gaga
    (SELECT 1
    THE DOUBLE)
    SELECT DeptNo
    GAGA)
    /

    The second statement gives an error ORA-01767: UPDATE... GAME expression must be a subquery:

    UPDATE scott.dept
    SET (deptno, dname) = (WITH AS gaga
    (SELECT 1,
    'CHANGED '.
    THE DOUBLE)
    SELECT deptno,
    DNAME
    GAGA)
    /

    What's wrong? Is this a limitation of Oracle 9i?

    Thank you
    Heinz

    Hello

    It is not fair to Oracle 9; I get the same error in Oracle 11.
    Use MERGE instead of UPDATE. (Sorry, I do not have Oracle 9, so I can't test that it works there, but WITH works MERGE in Oracle 10 and 11; no hide or workaround is necessary).

    If you want to use the UPDATE and you really need to use a WITH clause (and, of course, you don't have in this simple example), you can hide the WITH clause in a view in line, like this:

    UPDATE scott.dept
    SET ( deptno, dname ) = (
                                       SELECT  *
                     FROM        (
                               WITH gaga AS
                             (        SELECT  1, ...
                             ) ...
                          )
                      )
    ;
    
  • UPDATE multiple columns with conditional parameters

    I have a procedure that updates several columns of a table using the parameter of the procedure. Is it possible to have a update unique with the parameter SET conditional statement?
    CREATE TABLE TEMP
    (POL_NUM NUMBER,
    OED DATE,
    TERM NUMBER,
    TRANS_CD CHAR(2));
    
    INSERT INTO TEMP VALUES (1, '1 AUG 2009', 12, 'NB');
    INSERT INTO TEMP VALUES (2, '4 AUG 2009', 12, 'XL');
    INSERT INTO TEMP VALUES (3, '2 AUG 2009', 12, 'RN');
    COMMIT;
    
    CREATE OR REPLACE PROCEDURE TMP_PROC (
      pPOL_NUM NUMBER,
      pOED IN DATE,
      pTERM IN NUMBER,
      pTRANS_CD CHAR2)
    AS
    BEGIN
      IF pOED IS NOT NULL THEN
        UPDATE TEMP SET OED = pOED WHERE POL_NUM = pPOL_NUM;
      END IF;
    
      IF pTERM IS NOT NULL THEN
        UPDATE TEMP SET TERM = pTERM WHERE POL_NUM = pPOL_NUM;
      END IF;
    
      IF pTRAN_CD IS NOT NULL THEN
        UPDATE TEMP SET TRANS_CD = pTRANS_CD WHERE POL_NUM = pPOL_NUM;
      END IF;
      COMMIT;
    EXCEPTION
      WHEN OTHERS THEN
         NULL;
    END;
    Is it possible to replace several IFs code to have only one UPDATE statement with the condition that update the column only if the parameter passed is not null? In the real world scenario, I have more than 3 columns and I do not want to write lots of IF blocks.

    Please help gurus!

    Published by: Kuul13 on September 18, 2009 13:26

    Hello

    Maybe this,.

    Create OR Replace Procedure TMP_PROC( pPOL_NUM  IN Number
                                        , pOED      IN Date
                                        , pTERM     IN Number
                                        , pTRANS_CD IN Varchar2 ) As
    Begin
       UPDATE TEMP
          SET OED      = NVL(POED     , OED )
            , TERM     = NVL(PTERM    , TERM )
            , TRANS_CD = NVL(PTRANS_CD, TRANS_CD )
        WHERE POL_NUM = PPOL_NUM;
       Commit;
    Exception
       When Others Then
          Null;
    End;
    

    Kind regards
    Christian Balz

  • Update multiple columns with case

    I have this and I wanted to have it in a single update to the case when then etc. Anyone?

    UPDATE TABLE_NAME

    SET CIITM_ITEM_RATE = 9

    WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 11 AND CIITM_CODE = 2;

    --8288 lines are updated.

    UPDATE TABLE_NAME

    SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 2

    WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 12 AND CIITM_CODE = 2;

    -513 lines to date.

    UPDATE TABLE_NAME

    SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 3

    WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 13 AND CIITM_CODE = 2;

    -39 lines to date.

    UPDATE TABLE_NAME

    SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 4

    WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 14 AND CIITM_CODE = 2;

    -15 updated lines to date.

    UPDATE TABLE_NAME

    SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 5

    WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 15 AND CIITM_CODE = 2;

    -5 lines to date.

    UPDATE TABLE_NAME

    SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 6

    WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 16 AND CIITM_CODE = 2;

    -4 lines to date.

    UPDATE TABLE_NAME

    SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 7

    WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 17 AND CIITM_CODE = 2;

    UPDATE TABLE_NAME

    SET CIITM_ITEM_RATE = 9,

    CIITM_NUMIT = CASE CIITM_ITEM_RATE

    11. WHEN CAN CIITM_NUMIT

    OF OTHER CIITM_ITEM_RATE - 10

    END

    WHERE CIITM_APPLICATION = 7

    AND CIITM_ITEM_RATE BETWEEN 11 AND 17

    AND CIITM_CODE = 2;

    SY.

  • Get Null when updating multiple records

    Hi all

    super.processFormRequest (pageContext, webBean);
    Am = (XxSupppacklistAMImpl) pageContext.getApplicationModule (webBean) XxSupppacklistAMImpl;

    String s1 = pageContext.getParameter ("ItemNumber");
    System.out.println ("The Parent point Nukmber is:" + s1);

    If (PageContext.GetParameter ("ParentItem")! = null)
    {
    String s2 = pageContext.getParameter ("ParentItem");
    System.out.println ("the Parent element will be", + s2);
    }
    System.out.println ("Hello I'm in the selectAll method," + s1);

    I was null, when executing the above code.
    could you please, help me on this.


    ThankswithRegards,

    Hello

    B4 value to write more if condition

    If (Row.GetAttribute ("ParentItem")! = null)
    {
    parent = row. GetAttribute("ParentItem").toStrring ();
    }

    Regards
    Meher Irk

  • Update the records in the table

    I have an INCOME_LOT table. Now, I need to update records with the current max (lot_id) + rownum where lot_id = 0.
    Note: There are multiple records with lot_id = 0.

    CREATE TABLE INCOME_LOT
    (
    LOT_ID NUMBER OF NON-NULL,
    NUMBER OF DETAIL_ID
    DATE OF EFFECTIVE_DATE,
    DATE OF UPDATE_DATE
    )
    It is only a sample data of 4 records, while in fact, I have millions of records to be updated.

    Insert into INCOME_LOT
    (LOT_ID, DETAIL_ID, EFFECTIVE_DATE, UPDATE_DATE)
    Values
    (0, 5773490, TO_DATE (MAY 5, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (MAY 6, 2014 00:22:40 ',' DD/MM/YYYY HH24:MI:SS'));))
    Insert into INCOME_LOT
    (LOT_ID, DETAIL_ID, EFFECTIVE_DATE, UPDATE_DATE)
    Values
    (0, 5773491, TO_DATE (MAY 5, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (MAY 6, 2014 00:22:40 ',' DD/MM/YYYY HH24:MI:SS'));))
    Insert into INCOME_LOT
    (LOT_ID, DETAIL_ID, EFFECTIVE_DATE, UPDATE_DATE)
    Values
    (0, 5773492, TO_DATE (MAY 5, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (MAY 6, 2014 00:22:40 ',' DD/MM/YYYY HH24:MI:SS'));))
    Insert into INCOME_LOT
    (LOT_ID, DETAIL_ID, EFFECTIVE_DATE, UPDATE_DATE)
    Values
    (0, 5773493, TO_DATE (MAY 5, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (MAY 6, 2014 00:22:41 ',' DD/MM/YYYY HH24:MI:SS'));))
    COMMIT;

    Can someone help me to update all records with a single SQL query or maybe a PL/SQL block? I could design a cursor to update, but it would be tedious to use.

    Do you want this:

    UPDATE INCOME_LOT

    Set lot_id = 262696 + ROWNUM

    WHERE lot_id = 0;

  • update of table with similar registration information using the same key

    Version: 11.1.0.7.0

    We have large table probably 30 M records

    -test code table follows

    create table people)

    person_id number,

    first name varchar2 (50).

    middle_name varchar2 (50).

    last_name varchar2 (50)

    );

    insert into persons (person_id, first_name, last_name, middle_name) values (1, 'JOHN', 'A', 'DOE');

    insert into people (person_id, first_name, last_name, middle_name) values (1, 'JOHN', ","DOE");

    insert into persons (person_id, first_name, last_name, middle_name) values (1, 'JOHN', 'ADAM', 'DOE');

    insert into persons (person_id, first_name, last_name, middle_name) values (2, 'JOHN', ' C ', 'DOE');

    insert into people (person_id, first_name, last_name, middle_name) values (2, 'JOHN', ","DOE");

    insert into people (person_id, first_name, last_name, middle_name) values (3, 'JOHN', ","MOE");

    insert into persons (person_id, first_name, last_name, middle_name) values (3, 'JOHN', 'FRANK', 'MOE');

    I am trying to write more efficient code to take the middle name of the most complete and updated all records with the same KEY (person_id) with her.

    Expected result:

    1, JOHN, ADAM, DOE

    1, JOHN, ADAM, DOE

    1, JOHN, ADAM, DOE

    2, JOHN, C., DOE

    2, JOHN, C., DOE

    3, JOHN, FRANK, MOE

    3, JOHN, FRANK, MOE

    Hello

    Here is an example of the use of the aggregate LAST instead of the function ROW_NUMBER analytic function:

    MERGE INTO dst people

    WITH THE HELP OF)

    WITH got_longest_middle_name AS

    (

    SELECT person_id

    , MIN (middle_name) DUNGEON (DENSE_RANK LAST ORDER OF LENGTH (REPLACE (middle_name, '.')))

    AS longest_middle_name

    AMONG the people

    WHERE middle_name IS NOT NULL

    GROUP BY person_id

    )

    SELECT person_id

    longest_middle_name

    Got_longest_middle_name c - c is for candidates

    WHERE DOES NOT EXIST)

    SELECT 1

    AMONG the people

    WHERE person_id = c.person_id

    AND c.longest_middle_name NOT AS REPLACE (middle_name, '.'). '%'

    )

    )             src

    WE (dst.person_id = src.person_id)

    WHEN MATCHED THEN UPDATE

    SET dst.middle_name = src.longest_middle_name

    WHERE dst.middle_name <> src.longest_middle_name

    OR dst.middle_name IS NULL

    ;

    I suspect that this may be a little faster, but try it on your system with your data to make sure.

  • Problem updating multiple rows in the table using subquery

    Hi everyone, I can't update multiple lines with a subquery. Here is the configuration:
    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, by using an update statement (or merge if this is better), I mean set values for col_d where col_b = 3 equal to that of the col_d where col_b = 1 and col_c equal between them. Results should resemble 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     17
    I see her there within my reach using this query, where I want to put b_col_d = a_col_d, but miss me something, this query returns too many rows when it is 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_c
    Update column_d set mytable = (select? where?)

    Can someone help me get there? I use 10 gr 2.

    Thank you!
    Mark

    I hope that's what you're 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 very much for providing the sample data in a format that is easy to consume form, as well as the expected results.

Maybe you are looking for

  • "Important deleted" what is it?

    HelloI've seen this several times but no idea what it is...From time to time, I see the message "2 messages deleted from the important".Possible not the exact phrase as it is quite a small message. OK where is "Important".Why I can't find deleted gar

  • turn off the graphics card for hp Compaq dc 7800

    I installed a nvidia quadro fx 580 graphics card, but I want to activate the built-in vga card and disable the nvidia card to switch between maps

  • NEITHER 9225 flow Acq

    Hello I have a NI 9225 in a cDAQ-9174 chassis.  I have the software to set a calendar of 1000 Hz sample clock, and then trigger a reminder once 1000 samples are acquired.  Acquisition mode is continuous.  The callback is triggered after 620 mSec. No

  • on dv6 fingerprint reader has stopped working after installing Norton 2012

    Fingerprint reader has stopped working after installing Norton Internet Security 2012 on both of my notebooks from HP. Product name: HP Pavilion dv6 Operating system: Windows 7 64-bit Error message in Device Manager under biometric devices in Device

  • Svchost.exe causing 100% cpu usage during the update of windows, even when disconnected.

    I recently had to re - install windows xp on a new hard drive for replacement. My version of xp home edition, SP2 OEM installation disc. (This is ith group included IE6) Once installed and running, could access windows update. Read all the threads as