Override the unique record of the table

friends
i am having a record in the table , and always i want the latest value in the table.
the record is with 4 fields.
mandt primary key
numb  primary key
username
date
now in the program i read the numb from the ztable and after reading that
i want to update the field with +1 ie override the old record.
I tried with update and modify statement  but they are inserting the new record,
i tried the where clause but that is not working.
when i am using modify statement i am using numb+1 , so it is inserting the new record.
  How to handle this situation , please advice

Hi,
  As Number is primary key, After reading and adding Number then you need to delete the existing latest record and Insert the new record.
For EX
NUM  USERNAME
0001  NAREN
0002 SATISH
0003 RAVI
Then last number is 0003 , add 1 then num is 0004.Then delete 0003 RAVI
and add 0004 RAVI
then DATA becomes
NUM  USERNAME
0001  NAREN
0002 SATISH
0004 RAVI
Hope this will help  you.
Thanks and Regards,
Narendra.Soma

Similar Messages

  • How to delete the duplicate records in a table without promary key

    I have a table that contains around 1 million records and there is no promary key or auto number coulums. I need to delete the duplicate records from this table. what is the simple effective way to do this.

    Please see this link:
    Remove duplicate records ...
    sqldevelop.wordpress.com

  • How to find the longest record in a table?

    Hello,
    Is there a function to find the longest record in a table? Or is there a data dictionary that would tell you which record contains the longest data?
    I have a table with five columns and one million records. I want to find the record (5 columns combined) with the longest data. Thank you.

    Dear watson2000!
    The function "VSIZE" tells you the number of bytes in the internal representation of a column which means the size of a value within a column. An example of vsize can be found here:
    [http://www.adp-gmbh.ch/ora/sql/vsize.html]
    So I think you should try it with this query to get the size of the longest record:
    SELECT MAX(VSIZE(column1)) +
           MAX(VSIZE(column2))  +
           MAX(VSIZE(column3))  +
           MAX(VSIZE(column4))  +
           MAX(VSIZE(column5)) AS "Maximum Row"
    FROM your_table;To identify the longest record try like this:
    SELECT rowid
    FROM   your_table
    GROUP BY rowid
    HAVING  (MAX(VSIZE(column1)) +
             MAX(VSIZE(column2)) +
             MAX(VSIZE(column3)) +
             MAX(VSIZE(column4)) +
             MAX(VSIZE(column5))) = (SELECT MAX(VSIZE(column1)) +
                                          MAX(VSIZE(column2))  +
                                          MAX(VSIZE(column3))  +
                                          MAX(VSIZE(column4))  +
                                          MAX(VSIZE(column5))
                                   FROM your_table;)I hope that these two queries could be of help to you.
    yours sincerely
    Florian W.
    Edited by: Florian W. on 23.04.2009 20:53

  • Delete the parent records and child table records at a time

    hi all;
    I am facing the pbm like to delete the all records in child table and corresponding records in parent table at a time. so I want to delete the all the records in child table and corresponding parent records in parent table by using single SQL query. plz help me
    Thanks in advance

    You want to use one single SQL statement to delete the child records in a table and the corresponding master records in the master table??
    That's not quite possible with a single SQL, of course unless you are talking about Oracle Forms, where you have a relation and set the delete behavior to Cascading, like said in the above posts.
    Tony

  • DELETE THE MATCHED RECORDS IN DB2 TABLE

    DELETE THE MATCHED RECORDS IN DB2 TABLE
    sql server table sqlserver_emp(c1,c2,c3,4)
    records:1 2 3 4
    DB2 table db2_emp(c1 key,c2,c3,c4)
    records:1 2 5 6 7 8
    Both tables having same structure
    Matched records : 1 2
    1.Delete the matched records in db2 table : 1 2 (without using truncate option for DB2 in Anywhere)
    2.Finally Load all records in sql server(Because duplicate records in db2 already removed so no duplicates occured)
    3.NEED final OUTPUT AS:db2 table: 5 6 7 8 1 2 3 4
    Note:
    1.DB2 truncate doesn't used
    2.STARING AREA: ORACLE
    3.SQLSERVER AND DB2 CLOSED ENVIRONMENT DOESN'T USED AS STAGING AREA.
    HOW MANY INTERFACES AND PROCEDURES SHOULD BE CREATE? WHAT ARE THEY?
    HOW TO REACH MY REQUIREMNT?
    Answer provider is more appricatable.
    Thanks in advance.
    Edited by: krishna on Nov 9, 2011 8:40 PM

    1st option
    See in this scenario you can use two interface and one procedure step.
    1st interface-->poricedure-->2nd interface
    1st interface will bring data to oracle staging-->then procedure will delete matched record from target using keys--->3rd interface will simple insert the the data in oracle staging.
    2nd option
    Insted of deleting the target matched records, you just update target matched record with latest records in your staging oracle.You can use IKM Merge
    Thanks

  • Read the last record in the database table..

    Hi..
    I am new to ABAP. So i have one condition to read the address number field in the last record from database table by using the person number where clause field.
    But the person number is same for some the records.
    So can any tell me the logic for to read the addressnumber field in the last record of selected records from database where personnumber is equal to some thing.
    Please help me..
    Thanks
    venki

    Hi Venkat ,
    u mean to say
    person number  addressnumber
    aa1            0000000000001
    aa1            0000000000002
    aa1            0000000000003
    aa1            0000000000004
    aa2            0000000000021
    aa3            0000000000110
    if i have to read the addressnumber 00000000000004
    of the person number aa1
    u can go like
    data v_address number like addressnumber.
    sort itab by personnumber addressnumber
    loop at itab .
    at end of personnumber.
    move addressnumber to v_addressnumber ..
    endat.
    endloop.
    so using control break statements i can fetch the last record of my person number if at all the same person number is having more than one address number ..
    hope this helps,
    Regards,
    Vijay
    Message was edited by: Vijay

  • To get the unique id of the selected row in a JTable as in Database

    Hi,
    After fetching the recodrs from the Database, I have displayed them in a JTable. Though I fetched all the columns from db, I am displying only only 2 columns, say Name and Number neither of which is unique, however I have a unique ID for each record in the db. Now when I select some row in the JTable, I need to know its unique ID (the one which is in the db) which i have not displayed in the JTable.
    Is there any API method that can store the unique ids of a table? Or how can this be done?
    Thanks in Advance.

    Although, if you don't want the Id visible in the table, then you need to remove its TableColumn from the TableColumnModel.
    Then when you want to reference the id you need to use:
    table.getModel.getValueAt(...);

  • Update a record is updating the first record in the DB...HELP!

    I am going over and over this again and cant find the problem.
    i have a form that sends email to emails that are on a php mysql db however when i update certain records it always is updating the first record in the DB...i have looked over this so many times and cant see what is going wrong
    the userid is not auto_increment but is based on the username (these are all unique)
    i have uncluded the code to see if i am missing something
    <?php require_once('../Connections/hostprop.php'); ?>
    <?php
    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;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE plus_signup SET email=%s, emailerSubject=%s, emailerContent=%s WHERE userid=%s",
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['emailerSubject'], "text"),
                           GetSQLValueString($_POST['emailerContent'], "text"),
                           GetSQLValueString($_POST['userid'], "text"));
      mysql_select_db($database_hostprop, $hostprop);
      $Result1 = mysql_query($updateSQL, $hostprop) or die(mysql_error());
          // Email Guarantor
              $to = $_POST['email'];
              $subject = "Email From Host Student Property";
              $message = "
              <html>
                        <head>
                                  <title>Dear ".GetSQLValueString($_POST['userid'], "text")."</title>
                        </head>
                        <body>
                                  <img src=\"http://www.hoststudent.co.uk/beta/images/hostlogo.gif\" alt=\"www.HostStudent.co.uk\" />
                                  <h2>An Email From Host Students</h2>
                                  <br /><br />
                                  <table>
                                            <tr>
                                                      <td>Email Subject:</td>
                                            </tr>
                                            <tr>
                                                      <td>".GetSQLValueString($_POST['emailerSubject'], "text")."</td>
                                            </tr>
                                            <tr>
                                                      <td>Email Content</td>
                                            </tr>
                                            <tr>
                                                      <td>".GetSQLValueString($_POST['emailerContent'], "text")."</td>
                                            </tr>
                                  </table>
                        </body>
              </html>
              // Always set content-type when sending HTML email
              $headers = "MIME-Version: 1.0" . "\r\n";
              $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
              $headers .= 'From: HostStudent.co.uk <[email protected]>' . "\r\n";
              $send = mail($to,$subject,$message,$headers);
      $updateGoTo = "TenantEmailSent.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    mysql_select_db($database_hostprop, $hostprop);
    $query_Recordset1 = "SELECT userid, email, emailerSubject, emailerContent FROM plus_signup";
    $Recordset1 = mysql_query($query_Recordset1, $hostprop) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <?
              session_start();
              if(!$_SESSION['loggedIn']) // If the user IS NOT logged in, forward them back to the login page
                        header("location:Login.html");
    ?>
       <script type="text/javascript">
    function loadFields(Value) {
             var Guarantor = Value.split("|");
              var userid1 = Guarantor[0] ;
                          var GuName = Guarantor[1];
              var GuPhoneEmail = Guarantor[2] ;
              document.getElementById('userid1').value=userid1;
                          document.getElementById('GuName').value=GuName;
              document.getElementById('GuPhoneEmail').value=GuPhoneEmail;
    </script>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
                  <table align="center">
          <tr valign="baseline">
            <td nowrap="nowrap" align="right"> </td>
            <td><select name="userid" id="userid" onchange="loadFields(this.value)">
              <option value="Select Guarantor">Select Guarantor</option>
              <?php
    do {
    ?>
    <option value="<?php echo $row_Recordset1['userid'] . '|' . $row_Recordset1['GuName'] . '|' . $row_Recordset1['GuPhoneEmail'];?>"><?php echo $row_Recordset1['userid'] . " , " . $row_Recordset1['GuName'] . " , " . $row_Recordset1['GuPhoneEmail']; ?></option>
              <?php
    } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
      $rows = mysql_num_rows($Recordset1);
      if($rows > 0) {
          mysql_data_seek($Recordset1, 0);
                $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    ?>
            </select></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">Tenant Name</td>
            <td><input type="text" name="userid1" id="userid1" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['userid'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">GuName:</td>
            <td><input type="text" name="GuName" id="GuName" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['GuName'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">GuPhoneEmail:</td>
            <td><input type="text" name="GuPhoneEmail" id="GuPhoneEmail" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['GuPhoneEmail'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">GuEmailerSubject:</td>
            <td><input type="text" name="GuEmailerSubject" value="" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">GuEmailerContent:</td>
            <td><textarea name="GuEmailerContent" cols="45" rows="5"> </textarea></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right"> </td>
            <td><input type="submit" value="Send email" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right"></td>
            <td> </td>
          </tr>
                  </table>
        <input type="hidden" name="MM_update" value="form2" />
        <input type="hidden" name="userid" value="<?php echo $row_Recordset1['userid']; ?>" />
    </form>

    i have found the problem, there were two forms with the same name..
    thanks

  • Master-Detail only shows the first record of the Master's data

    I have an ADF Master Table, Detail table. I use ExcuteWithParams on the Master Table. When executed from a button (Button has partial submit = true for button, Master Table has PartialTrigger on button, and Detail table has PartialTrigger on Master table and button), it works fine. However, I want to pass the parameters in pageFlowScope variables, and have the ExecuteWithParams invoked upon page load. When I try to do this, the Detail table only shows the first record of the Master's data, no mater what row is clicked on the Master table.
    Master table now has no PartialTrigger, and Detail table has PartialTrigger on Master table. In my pageDef, I used an invoke action as follows:
    <invokeAction Binds="ExecuteWithParams" id="invokeExecuteWithParams"
    Refresh="always"/>
    What am I missing? I am using verion 11.1.1.3. Any help would be much appreciated.
    Thanks,
    Jessica

    Yes, it works when I drag the data control as a master detail without filtering any data. I want the user to be able to set search criteria to filter the data in the master table (For example, only pull back data with a transaction date between :startdate and :enddate). I can get it to work if I execute from an executewithparams button on the page, but not if I want to invoke the executewithparams upon page load with the parameter set by pageflowscope variables.
    Thank you for responding.
    Jessica

  • Can we Highlight the TC record thoughout the screen.

    hi masters,
    i have small doubt... can we highlight the TC record throughout the screen?
    i have used the SET CURSER... Which works fine, but as soon as we take out the cursor the cursor will go.
    so can we in anyway highlight that record throughout the screen?
    thank you all for ur great support and highly appiricaited.
    pasala.

    In TC control there is an option to add a firld of length char1 but need not be displayed on the screen. So declare an internal table with an additional field flag of length char1. so while creating a TC using the wizard do not diplay this field and assign this field as selection column field.
    So now whenever you populate the table control , just make sure that the field flag is populated as 'X'. This will make the row as selected.
    Regards,
    Smithesh

  • HT204088 Hi team can your team send me the purchase record of the game barcode soccer

    Hi team
    Can your team send me back the purchase record for the game barcode soccer that I purchase under this account thanks

    This is a User to User Forum... What do you require and from whom...

  • My audio files no longer sync to the in the 5d in camera audio. It did when I bought the program but no longer does  I reinstalled and it still will not sync the files recorded on the H4N with the Canon 5D Mark Ii

    My audio files no longer sync to the in the 5d in camera audio. It did when I bought the program but no longer does  I reinstalled and it still will not sync the files recorded on the H4N with the Canon 5D Mark II  Camera. 
    The program used to import and transcode the Can 5D footage but no longer does.   The program freezes often and looses my projects as well.  Hard to make a living when your editing program is on strike!

    My audio files no longer sync to the in the 5d in camera audio. It did when I bought the program but no longer does  I reinstalled and it still will not sync the files recorded on the H4N with the Canon 5D Mark II  Camera. 
    The program used to import and transcode the Can 5D footage but no longer does.   The program freezes often and looses my projects as well.  Hard to make a living when your editing program is on strike!

  • I bought a team license for two computers, the purchase was recorded on the credit card and the amount recorded in the making, but was unable to validate the association staff . I received an email stating that Adobe could not release the payment and that

    I bought a team license for two computers, the purchase was recorded on the credit card and the amount recorded in the making, but was unable to validate the association staff .
    I received an email stating that Adobe could not release the payment and that I should validate the method of payment , tried to insert another card number but the system does not accept the security VAT reporting error message. How do I validate my license with association staff and confirm the payment card?

    Hi Daniel,
    For any sort of payment related matter, kindly contact our support team via:  http://helpx.adobe.com/in/contact.html?step=CCSN_adobe-id-signing-in_stillNeedHelp
    If you are unable to use chat option kindly try below mentioned steps.
    Try different browser.
    Delete cookies and cache
    If you are still not able to chat, Kindly reply with the below mentioned information.
    OS version:
    Browser Version:
    You can also try: http://helpx.adobe.com/x-productkb/global/phone-support-orders.html 
    Thanks,
    Atul Saini

  • The detailRegion is always forced to populate the first record from the Master region

    Hi fellow Spry enthusiasts,
    My question is in regards the undesirable data population of
    the regiondetail on initial load. I have 2 sections, one which is
    my master region (which goes out and retrieves a bunch of records),
    and a related detailregion which reacts based on the master.
    However, every time I initiate a query of the master region to
    retrieve records, the detail region also responds and automatically
    grabs the FIRST record of the master region (which is undesirable
    in my case because I do not want the detail region to react UNTIL I
    select a record in the master region). Let me know if this makes
    sense.
    Psuedo Code:
    var moveRequestor = new
    Spry.Data.XMLDataSet("cfc/QueryThatReturnsABunchOfEmployeeRecords")>
    <span spry:region="moveRequestor">
    {EM_ID}
    {NAME}
    <span spry:detailregion="moveRequestor">
    {EM_ID}
    {NAME}
    {PHONE}

    This question was posted a while ago, and was one of the
    search results that came up when I was looking for my own answer. I
    had a nearly identical question and answered it here:
    Disabling
    default linked region and detailregiondisply until click
    Hopefully it will help others too!

  • Reading text file and output (to stdout) a list of the unique words in the

    Hi,
    I have a main method as
    main.java
    package se.tmp;
    public class Main
    public static void main( String[] args )
    WordAnalyzer.parse( args[0] );
    and text file as
    words.txt
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the quick brown fox jumps over the lazy dog
    the requirement is like
    I need create this WordAnalyzer class, implement the parse method, and then commit the file. This method takes a single parameter, the filename of the file to parse. The method should read this file and output (to stdout) a list of the unique words in the file along with the number of times each appears in the file.
    Can anyone please help me on this?
    Thanks.

    Where are you having problems?

Maybe you are looking for