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

Tags: Database

Similar Questions

  • 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());}
    
  • How to view multiple records to a report form - as the model?

    Hi all
    I developed a form - like model report
    I want to show him several records at once (on the same page)
    I tried assigning a value of "Maximum records per page" property for the extensible framework 10
    but when I close the range property and open it again the value returns to 1!
    How to display multiple records on the same page?

    Thank you

    Hello

    check around your formatting images if all have the "vertical stretch" value to the variable or develop.

  • 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 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:

    
    
       
       
       
    
    
    
    
    
  • How to concatenate multiple records in a single

    Hello world:

    I want to know if is a way to concat multiple records into one without the help of the sliders. For example, I have a table named "Authors" like this:

    LAN | Author
    -----------------
    English | Ernest Hemingway
    Spanish | Octavio Paz
    Spanish | Mario Vargas Llosa
    English | Sinclair Lewis
    Spanish | Gabriel García Márquez


    And I want to get this:

    Author
    -----------------
    Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez

    I have worked with SQL Server and I can do something like this:

    CREATE FUNCTION dbo. MyConcat (@lan varchar (10))
    RETURNS varchar (5000) AS
    BEGIN
    declare @retvalue varchar (5000)
    Set @retvalue = "
    Select @retvalue = @retvalue + author + ',' authors where lan = @lan
    return substring (@retvalue, 1, len (@retvalue)-1)
    END

    That is to say, do not use cursors to concatenate records. However, with ORACLE, I do something like that.

    FUNCTION MyConcat(P_Lan IN VARCHAR2) VARCHAR2 IS BACK
    v_ret VARCHAR2 (4000);
    v_element VARCHAR2 (4000);
    v_cursor sys_refcursor;
    BEGIN
    OPEN to SELECT V_cursor author of authors where Lan = P_Lan
    LOOP
    SEEK v_cursor INTO v_elemento;
    OUTPUT WHEN v_cursor % NOTFOUND;
    IF v_ret IS NULL THEN
    v_ret: = v_element;
    ON THE OTHER
    v_ret: = v_ret | ', ' || v_element;
    END IF;
    END LOOP;
    RETURN v_ret;
    END;

    There is another way to to do?

    Best regards
    Jack

    You can find plenty of examples here:

    http://www.Oracle-base.com/articles/Misc/StringAggregationTechniques.php

    and also here:

    http://www.sqlsnippets.com/en/topic-11787.html

    Published by: hoek on October 21, 2010 17:50

  • 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

  • How to update a record, if it is a composite key (primary key is based on two columns) in the OPS? page?

    Hello

    Actually I got to know this update of a record must be made when the primary key is based on two columns.

    Previously, I used SPEL for a column. It was working fine.

    But I came to know that regardless of the folder I try to update, it was the update page is coming up with the first combination of the record.

    As if RC 131

    RC 124

    RC 125 are the records.

    If I click on update of RC 124 also, the update page is coming up with RC 131 values as it is the first.

    So I understand that the SPEL should be based on two parameters, because it is a composite key.

    How to do?

    Please let me know if you don't understand the problem.

    Thank you.

    Wow!

    I got it.

    Thank you brothers, always a hope that you could help me

  • 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.

  • How to display multiple records in a loop

    Hello

    This procedure returns some data.

    so please tell me how I can write a loop to display all the records from a Table.

    This is my procedure:

    create or replace procedure getEmpName
    *(*
    Employee in V_EMPID. EMPID % TYPE,
    V_EMPNAME employees. EMPNAME % TYPE
    *)*
    is
    Start
    Select empname into V_EMPNAME from employees where empid = '2';
    end;


    It's my block: how to write a loop here to display all of the records in my Table

    declare
    v_EMPNAME EMPLOYEE. EMPNAME % TYPE;
    Start
    getEmpName (2, v_EMPNAME);
    dbms_output.put_line (v_EMPNAME);
    end

    user10503747 wrote:
    so please tell me how I can write a loop to display all the records from a Table.

    Hello
    given the procedure displays all records in the table emp...

    CREATE OR REPLACE PROCEDURE Testloop
    AS
    CURSOR test1
    IS
    SELECT EMPNO, ENAME FROM EMP;
    BEGIN
    I'm IN test1
    LOOP
    DBMS_OUTPUT. Put_line (' Emp - ' | i.empno |) » -'|| i.ename);
    END LOOP;
    END;
    /

    Thnx
    MB

  • [ADF, JDev 12.1.3] How to display multiple records on the same page... not in a table but they appear a form for each record

    Hallo,

    I need to create a page that displays the records of a VO, but I would not use a table.

    Instead, I would like to display a form for each record to be displayed.

    Forms must appear one above the other and each form should have 2 buttons: one to remove the file/form itself and one to add a new file/form.

    When you press the button Add a new empty form should be dynamically added to the page (so that the user can fill) and created related record.

    When REMOVE button is pressed the form (which contains the operated button) should be disappear and the record shuould be deleted.

    Creations and destruction must be applied only if the user clicks a button on CONFIRMATION / COMMIT.

    Maybe this http://digilander.libero.it/flattit82/OTN_FILES/MultiFormPage.png picture can help to understand what I want to do.

    You kindly help me?

    Thank you

    Federico

    Hi Federico

    I was saying that your page layout can be achieved using af: table

    See this image:

    This provision is af:table (I think same as yours), just add a column in the table and put all the fields in this column then correct layout allows to design as a provision on the form or group layouts

    I'm not saying it's the best approach, but you can try this

    Thank you

  • How to enter multiple records

    Hi all

    I use oracle 10g and 10g db forms.

    I developed a form and the user will enter data into the form and click that box and press save data button get inserted into the table.

    If the user enters data two times and then click on the checkbox and enter the backup of the data that one button get inserted.

    Inside this XXBANK_GUARANTEE_HEADERS procedure. XXBANK_GUARANTEE_INSERT I wrote my insert statement.

    I have my code is like this

    BEGIN
    Premier_enregistrement;
    LOOP
    IF (: System.Last_Record = 'TRUE') THEN
    EXIT;
    ELSIF: BANK_GUARANTEE_BLK. CHECK_IN_OUT = 'Y '.
    THEN
    XXBANK_GUARANTEE_HEADERS. XXBANK_GUARANTEE_INSERT;
    Next_Record;
    END IF;
    END LOOP;
    END;


    Can someone pls correct me where I went worng.

    concerning
    srikkanth

    Hi try

    BEGIN
    First_Record;
    LOOP
    IF :BANK_GUARANTEE_BLK.CHECK_IN_OUT = 'Y'
    THEN
    XXBANK_GUARANTEE_HEADERS.XXBANK_GUARANTEE_INSERT;
    END IF;
    Exit when :System.Last_Record = 'TRUE'
    Next_Record;
    END LOOP;
    END;
    

    It is because once it reaches the last record, you have coded out, even before processing the file.
    Now, I put this condition of release at the last

  • How to retrieve multiple records in XML using PL/SQL with XE 10 g

    Hi all

    I need your advice, if you please.
    I have an object CLOB as a result of a Web Service, I need to analyze. I use the XE version, XQuery is not for me, I get SYS. Exception DBMS_XQUERYINT.

    I tried to use the snippet, but it looks like I'm doing something wrong there. Please tell me what should I change?

    (1) I have a temporary table with id and xmltype
    (2) I have tested that the example data in the table
    (3) I get nothing no matter if I use,'/ modifyPlannedItemStatus/days [1] / day_of_week_order "or simply,'/ modifyPlannedItemStatus/days [1] / day_of_week_order'."

    Thanks in advance


    DECLARE
    my_xml XMLTYPE.
    my_clob CLOB: =' <? XML version = "1.0" encoding = "UTF-8" standalone = 'no '? >
    < mgns1:modifyPlannedItemStatus xmlns:mgns1 = "http://www.mart-sw.co.uk/library" >
    < days >
    A < day_of_week_code > < / day_of_week_code >
    < day_of_week_order > 1 < / day_of_week_order >
    Monday < day_of_week_name > < / day_of_week_name >
    < / days >
    < days >
    < day_of_week_code > B < / day_of_week_code >
    < day_of_week_order > 2 < / day_of_week_order >
    Tuesday < day_of_week_name > < / day_of_week_name >
    < / days >
    < / mgns1:modifyPlannedItemStatus > ';

    I INTEGER: = 1;

    my_varchar VARCHAR2 (3000);
    BEGIN

    insert into session_temp_xml values (i, xmltype.createxml (my_clob));

    SELECT to_clob(extract(s.xml_data,'/modifyPlannedItemStatus/days[1]/day_of_week_order')) IN the s session_temp_xml my_varchar;


    dbms_output.put_line (' result ' |) RTrim (my_varchar));


    END;

    Hello

    'Re missing you the declaration of the namespace of the root node.

    extract( s.xml_data
           , '/mgns1:modifyPlannedItemStatus/days[1]/day_of_week_order'
           , 'xmlns:mgns1="http://www.mart-sw.co.uk/library"' )
    

    This will give you an instance of XMLType:

    1
    

    To convert it to CLOB or VARCHAR2 (i.e. to serialize the XML content in a character stream) use one of the getter methods getClobVal or getStringVal.
    If you want to retrieve the scalar value of the element (text node), use extractValue in place of the extract function.

    Here is an example on how to extract some repetitive elements in your version:

    SQL> create table session_temp_xml (
      2   id number,
      3   xml_data xmltype
      4  );
    
    Table created
    
    SQL> insert into session_temp_xml values (1, xmltype(
      2  '
      3  
      4  
      5   A
      6   1
      7   Monday
      8  
      9  
     10   B
     11   2
     12   Tuesday
     13  
     14  ')
     15  );
    
    1 row inserted
    
    SQL>
    SQL> SELECT extractValue(x.column_value, '/days/day_of_week_code') as day_of_week_code
      2       , extractValue(x.column_value, '/days/day_of_week_order') as day_of_week_order
      3       , extractValue(x.column_value, '/days/day_of_week_name') as day_of_week_name
      4  FROM session_temp_xml s
      5     , TABLE(
      6         XMLSequence(
      7           extract(
      8             s.xml_data
      9           , '/mgns1:modifyPlannedItemStatus/days'
     10           , 'xmlns:mgns1="http://www.mart-sw.co.uk/library"'
     11           )
     12         )
     13       ) x
     14  ;
    
    DAY_OF_WEEK_CODE      DAY_OF_WEEK_ORDER      DAY_OF_WEEK_NAME
    --------------------- ---------------------- ---------------------
    A                                          1 Monday
    B                                          2 Tuesday
     
    

    Hope that helps.

  • Data merge: how to get multiple records in a single text?

    Hello

    I'm experimenting with data merging in InDesign CS3. The biggest obstacle I've met tries to get my record flowing continuous text in a single text frame (which would, ideally, "automatic formatting" on the new pages in the document). Records vary considerably in length, and so I can't just create a standard repeat on the page text frame.

    Perhaps, data fusion is not the best way to achieve this and I should be learning to script in place. I feel like I'm just one step, however.

    Any suggestion would be appreciated.

    Data fusion is not thread. There is a nifty script to Rorohiko who will do it for you after the merger, however. Best strategy is to merge, run the script, delete everything except the first image on the first page, then pick up the excess and auto-flux in the document.

  • How to get multiple records in a line and a different column

    Hi all

    I am using oracle database 11g

    and I have a two table table_1, table_2
    table_1 has columns

    emp_no
    first name
    middle_name
    last_name
    E-mail

    and table_2 have columns
    emp_no
    phone_type
    Phone_Number

    and having entires

    emp_no phone_type phone_number
    1001 MOB 9451421452
    1001 WEMG 235153654
    1001 652341536 EMG
    1002 MOB 9987526312
    1003 WEMG 5332621456
    1004 59612356 EMG

    Now I want the output of values with the MOB or WEMG phone type in a single line with different columns

    emp_no first_name last_name middle_name officeno mobile e-mail

    1001 score null k 9451421452 235153654 [email protected]
    1002 chagneau gary [email protected] 9987526312 null
    1003 dany craig [email protected] 5332621456 null null
    1004 donald finn sian [email protected] null null



    Can I have any input to achieve this?


    Concerning

    $sid

    Hi Sid,

    Under query will be help for you...

    SELECT tab1.emp_no
    *, first name *.
    *, middle_name *.
    *, last_name *.
    *, email *.
    *, mobile t2.phone_number *.
    *, t3.phone_number officeno *.
    OF tab1
    *, (SELECT Emp_no *)
    *, phone_number *.
    Of THE tab2
    WHERE phone_type = "MOB") t2
    *, (SELECT Emp_no *)
    *, phone_number *.
    Of THE tab2
    WHERE phone_type = "WEMG") t3
    WHERE tab1.emp_no = t3.emp_no
    AND tab1.emp_no = t2.emp_no;

    Thnks,
    cveluri

Maybe you are looking for

  • Audio problems

    Hi, I have audio problems! I downloaded Skype on my windows laptop 10, and I have audio problems with only my Skype. I checked the audio setting on my laptop and they are very well, I tried to save regularly, and it was perfectly good. I checked the

  • Windows 7 drivers for p7 - 1447c

    new computer with windows 8, my MOM doesn't like him. want windows 7, more user friendly need drivers. P7 - 1447c

  • Phone screen Action

    So, I have the following code provided by RIM ready to use in my application: package com.rim.samples.device.phonescreendemo; import net.rim.blackberry.api.phone.AbstractPhoneListener; import net.rim.blackberry.api.phone.Phone; import net.rim.blackbe

  • Select the Tunnel-Group based on OS devices

    Hello having an ASA5512x is possible to have anyconnect-dial-in-PC-users asking their IDs AND also a one-time-password Whereas smartphone users only need to provide their username and a password without the need to manually select the profile? I've s

  • Windows 7, impossible to print HP Laserjet 1160 or Epson Artisan 725

    Original title: I can not HP Laserjet 1160 or Epson Artisan 725 printing on Win 7... tried everything... Always error or troubleshooting... No luck... Need help badI can not HP Laserjet 1160 or Epson Artisan 725 printing on Win 7.  I have tried every