Help with Update if record exists else insert record  "upsert"

Hi Friends,
i have this table:
CREATE
  TABLE TB_GEN_COMPANY
    "ID_COMPANY"   NUMBER NOT NULL ENABLE,
    "COD_CODIGO"    VARCHAR2(10 BYTE) NOT NULL ENABLE,
    "DES_NAME"    VARCHAR2(64 BYTE) NOT NULL ENABLE,
    "DES_DIRECTION" VARCHAR2(128 BYTE) NOT NULL ENABLE,
    "COD_RUC"       CHAR(11 BYTE) NOT NULL ENABLE,
    "FLG_EST"    CHAR(1 BYTE) NOT NULL ENABLE,
    "COD_USR_CR"  VARCHAR2(16 BYTE) NOT NULL ENABLE,
    "FCH_FEC_CR" TIMESTAMP (6) NOT NULL ENABLE,
    "COD_USR_MOD" VARCHAR2(16 BYTE) NOT NULL ENABLE,
    "FCH_FEC_MOD" TIMESTAMP (6) NOT NULL ENABLE,
    CONSTRAINT "TB_GEN_COMPANIA_ESTADO_CHK" CHECK (FLG_ESTADO IN ('A', 'I'))
    CONSTRAINT "TB_GEN_COMPANIA_PK" PRIMARY KEY ("ID_COMPANIA")
  )I want to validate the code (cod_codigo). if the record exists, i will have to update with the news inputs parameters, otherwise it should create a new one i mean, an Insert.
Thanks for t he help.
Sorry for bad engl.

i have this:
DECLARE
    strCod_Compania  VARCHAR2(10):='123';
    strdes_Nombre  VARCHAR2(64):='compname';
    strdes_Direccion  VARCHAR2(128):='calle las 123 santa beatriz';
    strCod_CompaniaRuc  VARCHAR2(11):='12345678911';
BEGIN
MERGE INTO TB_GEN_COMPANIA e
USING
TB_GEN_COMPANIA d
ON (e.cod_codigo=strCod_Compania)
WHEN MATCHED THEN
  UPDATE
  SET e.DES_NOMBRE=strdes_Nombre,
      e.DES_DIRECCION=strdes_Direccion,
      e.COD_RUC=strCod_CompaniaRuc,
      e.FLG_ESTADO='A'
WHEN NOT MATCHED THEN
INSERT (COD_CODIGO,
        DES_NOMBRE,
        DES_DIRECCION,
        COD_RUC,
        FLG_ESTADO,
        COD_USR_CREA,
        FCH_FEC_CREA,
        COD_USR_MOD,
        FCH_FEC_MOD)
VALUES
        (strCod_Compania,
        strdes_Nombre,
        strdes_Direccion,
        strCod_CompaniaRuc,
        'A',
        'rmolina',
        SYSDATE(),
        'rmolina2',
        SYSDATE());
END;
/this is my table:
CREATE TABLE "TB_GEN_COMPANIA"
   (     "COD_CODIGO" VARCHAR2(10 BYTE),
     "DES_NOMBRE" VARCHAR2(64 BYTE),
     "DES_DIRECCION" VARCHAR2(128 BYTE),
     "COD_RUC" CHAR(11 BYTE),
     "FLG_ESTADO" CHAR(1 BYTE),
     "COD_USR_CREA" VARCHAR2(16 BYTE),
     "FCH_FEC_CREA" TIMESTAMP (6),
     "COD_USR_MOD" VARCHAR2(16 BYTE),
     "FCH_FEC_MOD" TIMESTAMP (6)
   )OK, when i execute the first query, 4 records are inserted in my table, and i don't know why,
any idea to solve this please?
Thanks

Similar Messages

  • MAC OS 10.6.8 Using Safari 5.1 Needing Help With Updating Adobe Flash

    Hello-
    Recently Adobe Flash installed an icon in my System Preferences and when I click the icon there are several tabs.  One allows updates to check automatically.  It says it will install the latest version of Flash without having to remove the previous version, but I have never been told that a newer version is available unless I clcik "check now."  although "Check for updates automatically" is checked, I do not know where it tells me a newer version is available.  Also, there has been 5 "newer versions" available since this icon was installed in System Prefeences, I have only found out about the newer versions when I clicked "Check Now."  If I read that with this new way to install the latest Mac version of Flash does not require me to uninstall the previous version of Flash how do I install the most recent version of Flash?  Does it come in an email?
    Since it is not telling me that there is a more recent version of Flash unless I click "Check Now" should I still do it the way I used to install the latest version of flash?  (The way before this icon was added to System Preferences)?
    I would appreciate help with updating Flash to the most recent version.  I used to uninstall the older version, restart the browser and download the most recent version and install it.  It always worked find but this was before there was an Adobe icon in my system Preferences.

    Hello,
    The way you used to do this (uninstall, restart the browser, etc.) is still definitely valid and probably the "safest" way to get a new version installed.  Uninstalling shouldn't be required, but it definitely doesn't hurt.  If you feel comfortable doing it the old way, please feel free to continue using that process.
    As for notifications, this is a bit trickier, but in general you should be notified within 30 days (or so) after a new player is released.  This usually occurs when the browser loads swf content.  Clicking the button will, like you mention, immediately check.  Another alternative to finding out when a new player is released is to subscribe to our Flash Player Releases feed.
    Is there a way to be automatically notified when a new Flash Runtime release is made?
    Thanks,
    Chris

  • Help with updates for CS6

    I need help installing latest updates for CS6.  I have Win 7 and have tried updating from the Help - Updates menu.  The error is:  U43M1D207.

    Thanks for your response.  I am in the United States in So. Arizona.
    Date: Fri, 5 Oct 2012 12:21:45 -0600
    From: [email protected]
    To: [email protected]
    Subject: Help with updates for CS6
    Re: Help with updates for CS6 created by Jeff A Wright in Downloading, Installing, Setting Up - View the full discussion
    Crunkle1 you are welcome to work directly with our support team for guided assistance.  If you go to http://www.adobe.com/ and select Help and Contact Us you should be given the option to contact our support team via telephone.  Which country/region are you in?
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4752605#4752605
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4752605#4752605
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4752605#4752605. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Downloading, Installing, Setting Up by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • HT201541 I need help with updating my browser.

    I need help with updating my browser.  Its telling me that Safari is outdated.

    That is a very old version belonging to Snow Leopard. I take it you are not actually running Yosemite.
    Upgrading to Yosemite
    You can upgrade to Yosemite from Lion or directly from Snow Leopard. Yosemite can be downloaded from the Mac App Store for FREE.
    Upgrading to Yosemite
    To upgrade to Yosemite you must have Snow Leopard 10.6.8 or Lion installed. Download Yosemite from the App Store. Sign in using your Apple ID. Yosemite is free. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
        OS X Mavericks/Yosemite- System Requirements
          Macs that can be upgraded to OS X Yosemite
             1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later
             7. Xserve (Early 2009) - Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
         Are my applications compatible?
             See App Compatibility Table - RoaringApps.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mavericks, it may still meet the requirements to install Lion.
    You can purchase Lion at the Online Apple Store. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.

  • Help with updates - The software change returned error code 0x87D00215(-2016411115).

    I have rolled out bunch of updates across few hundred workstation systems.
    Few of the desktops have failed to install SOME of the updates and just can't get my head around as to why?
    Looking at one of the workstations, I can see 5 updates are pending download at 0%.
    Some of these fail after a while and with in Software Centre, I can see 'Help with updates - The software change returned error code 0x87D00215(-2016411115).'. Not exactly sure what this means, but I have tried clearing the cache and
    rebooting the workstations few times.
    (I have also tried to use Windows Update and install one of these manually, which worked.)

    Investigating this further, I have found the following in CAS.log:
    ICcmContentTransferManager::ModifyJobPriority failed with error 0x87d00215 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    No need to change timeout settings ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Successfully created download request {ED6E9E5C-E806-43CA-9F93-49AC72D1DEAD} for content 53bf87a2-bedf-4def-b0ec-9637613c3429.1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Requesting locations synchronously for content 99ddb078-b780-4605-8fac-9607fe56450d.1 with priority Foreground ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    The number of discovered DPs(including Branch DP and Multicast) is 1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Calling back with the following distribution points ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Distribution Point='http://DPSERVER.com/SMS_DP_SMSPKG$/99ddb078-b780-4605-8fac-9607fe56450d', Locality='LOCAL' ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Requesting content 99ddb078-b780-4605-8fac-9607fe56450d.1, size(KB) 0, under context System with priority Foreground ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    ICcmContentTransferManager::ModifyJobPriority failed with error 0x87d00215 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    No need to change timeout settings ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Successfully created download request {67B7E59B-A386-4EA8-BF39-2EB64B108A6C} for content 99ddb078-b780-4605-8fac-9607fe56450d.1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Requesting locations synchronously for content 61d33de7-9582-41e3-82fc-3e0f970b60f3.1 with priority Foreground ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    The number of discovered DPs(including Branch DP and Multicast) is 1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Calling back with the following distribution points ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Distribution Point='http://DPSERVER.com/SMS_DP_SMSPKG$/61d33de7-9582-41e3-82fc-3e0f970b60f3', Locality='LOCAL' ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Requesting content 61d33de7-9582-41e3-82fc-3e0f970b60f3.1, size(KB) 0, under context System with priority Foreground ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    ICcmContentTransferManager::ModifyJobPriority failed with error 0x87d00215 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    No need to change timeout settings ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
    Successfully created download request {12E48136-B545-4C42-9745-9FF97CE38D52} for content 61d33de7-9582-41e3-82fc-3e0f970b60f3.1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)

  • Help with update,add, delete records

    Hi every one,
    This is a problems that I have been trying to figure out for
    a little while now and I hope you all can help me out. So this is
    the situation.
    I am useing CFX XLS 2 Query to create a query from an excel
    doc I have. Now my problem is how can I loop through and delete the
    records that no longer are in the spreadsheet?
    So in other words my client will be uploading a new XLS each
    day, this xls will have some new data, some of the same and some
    will be gone. So I need the system to check and see if the
    stocknumber is there, if it is it will just update that record, now
    if the record is new it will add the record but for the life of me
    I can't figure out how it can delete record.
    I had thought maybe doing a select where the stock numbers
    dont match but that didnt work out too well :)
    Thanks for any help you may be able to provide

    You could consider using ValueList() to create a list of
    stocknumbers from your excel query, then do something like this:
    <cfset sCurrentStockNumbers =
    ValueList(myQuery.stocknumber)>
    <cfquery name="removeStockNumbers"
    datasource="myDataSource">
    DELETE from myTable
    WHERE stocknumber NOT IN (<cfqueryparam
    value="#sCurrentStockNumbers#" list="Yes">)
    </cfquery>

  • Need Help With File Matching Records

    I need help with my file matching program.
    Here is how it suppose to work: FileMatch class should contain methods to read oldmast.txt and trans.txt. When a match occurs (i.e., records with the same account number appear in both the master file and the transaction file), add the dollar amount in the transaction record to the current balance in the master record, and write the "newmast.txt" record. (Assume that purchases are indicated by positive amounts in the transaction file and payments by negative amounts.)
    When there is a master record for a particular account, but no corresponding transaction record, merely write the master record to "newmast.txt". When there is a transaction record, but no corresponding master record, print to a log file the message "Unmatched transaction record for account number ..." (fill in the account number from the transaction record). The log file should be a text file named "log.txt".
    Here is my following program code:
    // Exercise 14.8: CreateTextFile.java
    // creates a text file
    import java.io.FileNotFoundException;
    import java.lang.SecurityException;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import org.egan.AccountRecord;
    import org.egan.TransactionRecord;
    public class CreateTextFile
      private Formatter output1;  // object used to output text to file
      private Formatter output2;  // object used to output text to file
      // enable user to open file
      public void openTransFile()
        try
          output1 = new Formatter("trans.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openTransFile
      // enable user to open file
      public void openOldMastFile()
        try
          output2 = new Formatter("oldmast.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openOldMastFile
      // add transaction records to file
      public void addTransactionRecords()
        // object to be written to file
        TransactionRecord record1 = new TransactionRecord();
        Scanner input1 = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
          "To terminate input, type the end-of-file indicator",   
          "when you are prompted to enter input.",
          "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
          "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s\n%s",
           "Enter account number (> 0) and amount.","? ");
        while (input1.hasNext())  // loop until end-of-file indicator
          try // output values to file
            // retrieve data to be output
            record1.setAccount(input1.nextInt());    // read account number
            record1.setAmount(input1.nextDouble());  // read amount
            if (record1.getAccount() > 0)
              // write new record
              output1.format("%d %.2f\n", record1.getAccount(), record1.getAmount());
            } // end if
            else
              System.out.println("Account number must be greater than 0.");
            } // end else
          } // end try
          catch (FormatterClosedException formatterClosedException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input1.nextLine(); // discard input so user can try again
          } // end catch
          System.out.printf("%s %s\n%s", "Enter account number (> 0) ",
            "and amount.","? ");
        } // end while
      } // end method addTransactionRecords
      // add account records to file
      public void addAccountRecords()
        // object to be written to file
        AccountRecord record2 = new AccountRecord();
        Scanner input2 = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
          "To terminate input, type the end-of-file indicator",   
          "when you are prompted to enter input.",
          "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
          "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s\n%s",
           "Enter account number (> 0), first name, last name and balance.","? ");
        while (input2.hasNext())  // loop until end-of-file indicator
          try // output values to file
            // retrieve data to be output
            record2.setAccount(input2.nextInt());    // read account number
            record2.setFirstName(input2.next());      // read first name
            record2.setLastName(input2.next());       // read last name
            record2.setBalance(input2.nextDouble());  // read balance
            if (record2.getAccount() > 0)
              // write new record
              output2.format("%d %s %s %.2f\n", record2.getAccount(), record2.getFirstName(),
                record2.getLastName(), record2.getBalance());
            } // end if
            else
              System.out.println("Account number must be greater than 0.");
            } // end else
          } // end try
          catch (FormatterClosedException formatterClosedException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input2.nextLine(); // discard input so user can try again
          } // end catch
          System.out.printf("%s %s\n%s", "Enter account number (> 0),",
            "first name, last name and balance.","? ");
        } // end while
      } // end method addAccountRecords
      // close file
      public void closeTransFile()
        if (output1 != null)
          output1.close();
      } // end method closeTransFile
      // close file
      public void closeOldMastFile()
        if (output2 != null)
          output2.close();
      } // end method closeOldMastFile
    } // end class CreateTextFile--------------------------------------------------------------------------------------------------
    // Exercise 14.8: CreateTextFileTest.java
    // Testing class CreateTextFile
    public class CreateTextFileTest
       // main method begins program execution
       public static void main( String args[] )
         CreateTextFile application = new CreateTextFile();
         application.openTransFile();
         application.addTransactionRecords();
         application.closeTransFile();
         application.openOldMastFile();
         application.addAccountRecords();
         application.closeOldMastFile();
       } // end main
    } // end class CreateTextFileTest-------------------------------------------------------------------------------------------------
    // Exercise 14.8: TransactionRecord.java
    // A class that represents on record of information
    package org.egan; // packaged for reuse
    public class TransactionRecord
      private int account;
      private double amount;
      // no-argument constructor calls other constructor with default values
      public TransactionRecord()
        this(0,0.0); // call two-argument constructor
      } // end no-argument AccountRecord constructor
      // initialize a record
      public TransactionRecord(int acct, double amt)
        setAccount(acct);
        setAmount(amt);
      } // end two-argument TransactionRecord constructor
      // set account number
      public void setAccount(int acct)
        account = acct;
      } // end method setAccount
      // get account number
      public int getAccount()
        return account;
      } // end method getAccount
      // set amount
      public void setAmount(double amt)
        amount = amt;
      } // end method setAmount
      // get amount
      public double getAmount()
        return amount;
      } // end method getAmount
    } // end class TransactionRecord -------------------------------------------------------------------------------------------------
    // Exercise 14.8: AccountRecord.java
    // A class that represents on record of information
    package org.egan; // packaged for reuse
    import org.egan.TransactionRecord;
    public class AccountRecord
      private int account;
      private String firstName;
      private String lastName;
      private double balance;
      // no-argument constructor calls other constructor with default values
      public AccountRecord()
        this(0,"","",0.0); // call four-argument constructor
      } // end no-argument AccountRecord constructor
      // initialize a record
      public AccountRecord(int acct, String first, String last, double bal)
        setAccount(acct);
        setFirstName(first);
        setLastName(last);
        setBalance(bal);
      } // end four-argument AccountRecord constructor
      // set account number
      public void setAccount(int acct)
        account = acct;
      } // end method setAccount
      // get account number
      public int getAccount()
        return account;
      } // end method getAccount
      // set first name
      public void setFirstName(String first)
        firstName = first;
      } // end method setFirstName
      // get first name
      public String getFirstName()
        return firstName;
      } // end method getFirstName
      // set last name
      public void setLastName(String last)
        lastName = last;
      } // end method setLastName
      // get last name
      public String getLastName()
        return lastName;
      } // end method getLastName
      // set balance
      public void setBalance(double bal)
        balance = bal;
      } // end method setBalance
      // get balance
      public double getBalance()
        return balance;
      } // end method getBalance
      // combine balance and amount
      public void combine(TransactionRecord record)
        balance = (getBalance() + record.getAmount()); 
      } // end method combine
    } // end class AccountRecord -------------------------------------------------------------------------------------------------
    // Exercise 14.8: FileMatch.java
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import org.egan.AccountRecord;
    import org.egan.TransactionRecord;
    public class FileMatch
      private Scanner inTransaction;
      private Scanner inOldMaster;
      private Formatter outNewMaster;
      private Formatter theLog;
      // enable user to open file
      public void openTransFile()
        try
          inTransaction = new Scanner(new File("trans.txt"));
        } // end try
        catch (FileNotFoundException fileNotFoundException)
          System.err.println("Error opening file.");
          System.exit(1);
        } // end catch
      } // end method openTransFile
      // enable user to open file
      public void openOldMastFile()
        try
          inOldMaster = new Scanner(new File("oldmast.txt"));
        } // end try
        catch (FileNotFoundException fileNotFoundException)
          System.err.println("Error opening file.");
          System.exit(1);
        } // end catch
      } // end method openOldMastFile
      // enable user to open file
      public void openNewMastFile()
        try
          outNewMaster = new Formatter("newmast.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openNewMastFile
      // enable user to open file
      public void openLogFile()
        try
          theLog = new Formatter("log.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openLogFile
      // update records
      public void updateRecords()
        TransactionRecord transaction = new TransactionRecord();
        AccountRecord account = new AccountRecord();
        try // read records from file using Scanner object
          System.out.println("Start file matching.");
          while (inTransaction.hasNext() && inOldMaster.hasNext())
            transaction.setAccount(inTransaction.nextInt());     // read account number
            transaction.setAmount(inTransaction.nextDouble());   // read amount
            account.setAccount(inOldMaster.nextInt());     // read account number
            account.setFirstName(inOldMaster.next());      // read first name 
            account.setLastName(inOldMaster.next());       // read last name
            account.setBalance(inOldMaster.nextDouble());  // read balance
            if (transaction.getAccount() == account.getAccount())
              while (inTransaction.hasNext() && transaction.getAccount() == account.getAccount())
                account.combine(transaction);
                outNewMaster.format("%d %s %s %.2f\n",
                account.getAccount(), account.getFirstName(), account.getLastName(),
                account.getBalance());
                transaction.setAccount(inTransaction.nextInt());     // read account number
                transaction.setAmount(inTransaction.nextDouble());   // read amount
            else if (transaction.getAccount() != account.getAccount())
              outNewMaster.format("%d %s %s %.2f\n",
              account.getAccount(), account.getFirstName(), account.getLastName(),
              account.getBalance());         
              theLog.format("%s%d","Unmatched transaction record for account number ",transaction.getAccount());
          } // end while
          System.out.println("Finish file matching.");
        } // end try
        catch (NoSuchElementException elementException)
          System.err.println("File improperly formed.");
          inTransaction.close();
          inOldMaster.close();
          System.exit(1);
        } // end catch
        catch (IllegalStateException stateException)
          System.err.println("Error reading from file.");
          System.exit(1);
        } // end catch   
      } // end method updateRecords
      // close file and terminate application
      public void closeTransFile()
        if (inTransaction != null)
          inTransaction.close();
      } // end method closeTransFile
      // close file and terminate application
      public void closeOldMastFile()
        if (inOldMaster != null)
          inOldMaster.close();
      } // end method closeOldMastFile
      // close file
      public void closeNewMastFile()
        if (outNewMaster != null)
          outNewMaster.close();
      } // end method closeNewMastFile
      // close file
      public void closeLogFile()
        if (theLog != null)
          theLog.close();
      } // end method closeLogFile
    } // end class FileMatch-------------------------------------------------------------------------------------------------
    // Exercise 14.8: FileMatchTest.java
    // Testing class FileMatch
    public class FileMatchTest
       // main method begins program execution
       public static void main( String args[] )
         FileMatch application = new FileMatch();
         application.openTransFile();
         application.openOldMastFile();
         application.openNewMastFile();
         application.openLogFile();
         application.updateRecords();
         application.closeLogFile();
         application.closeNewMastFile();
         application.closeOldMastFile();
         application.closeTransFile();
       } // end main
    } // end class FileMatchTest-------------------------------------------------------------------------------------------------
    Sample data for master file:
    Master file                         
    Account Number            Name                     Balance
    100                            Alan Jones                   348.17
    300                            Mary Smith                    27.19
    500                            Sam Sharp                   0.00
    700                            Suzy Green                   -14.22Sample data for transaction file:
    Transaction file                    Transaction
    Account Number                  Amount
    100                                         27.14
    300                                         62.11
    300                                         83.89
    400                                         100.56
    700                                         80.78
    700                                         1.53
    900                                         82.17  -------------------------------------------------------------------------------------------------
    My FileMatch class program above has bugs in it.
    The correct results for the newmast.txt:
    100  Alan  Jones  375.31
    300  Mary  Smith  173.19
    500  Sam  Sharp  0.00
    700  Suzy Green  68.09The correct results for the log.txt:
    Unmatched transaction record for account number 400Unmatched transaction record for account number 900------------------------------------------------------------------------------------------------
    My results for the newmast.txt:
    100 Alan Jones 375.31
    300 Mary Smith 111.08
    500 Sam Sharp 0.00
    700 Suzy Green -12.69My results for the log.txt
    Unmatched transaction record for account number 700-------------------------------------------------------------------------------------------------
    I am not sure what is wrong with my code above to make my results different from the correct results.
    Much help is appreciated. Please help.

    From the output, it looks like one problem is just formatting -- apparently you're including a newline in log entries and not using tabs for the newmast output file.
    As to why the numbers are off -- just from glancing over it, it appears that the problem is when you add multiple transaction values. Since account.combine() is so simple, I suspect that you're either adding creating transaction objects incorrectly or not creating them when you should be.
    Create test input data that isolates a single case of this (e.g., just the Mary Smith case), and then running your program in a debugger or adding debugging code to the add/combine method, so you can see what's happening in detail.
    Also I'd recommend reconsidering your design. It's a red flag if a class has a name with "Create" in it. Classes represent bundles of independant state and transformations on that state, not things to do.

  • Help with Update task

    Hi friends,
    In the below am trying to update a custom table using a call function in update task. I dont see the table getting updated can someone take a look at it and let me knw what the problem is? I have the commit work statement and also marked the function module as an update one in the attribute. Please help me . Thanks in advance! kathy
    *&  Include           ZINBOUND_TEST
    Report: ZINBOUND_TEST.
    DATA: l_dest     TYPE REF TO if_bgrfc_destination_inbound,
          l_unit     TYPE REF TO if_trfc_unit_inbound,
          l_inb_dest TYPE bgrfc_main_i_dst,
          lv_matid TYPE /sapapo/matid,
          lv_matnr TYPE /sapapo/matnr,
          lv_maktx type /SAPAPO/MAKTX,
          lv_langu  TYPE LANGU.
    data: lt_product type  STANDARD TABLE OF ZUPDATE,
          ls_product type ZUPDATE.
    lv_matid = '123'.
    lv_langu = 'E'.
    lv_maktx = 'Materia1'.
    CALL FUNCTION 'Z_TEST' IN UPDATE TASK
      EXPORTING
        iv_matid = lv_matid
        iv_maktx = lv_maktx
        iv_langu = lv_langu .
    COMMIT WORK.
    select * from zupdate into corresponding fields OF TABLE lt_product.
    if sy-subrc <> 0.
      write 'no records added'.
    else.
      loop at lt_product into ls_product.
        write: / ls_product-MATID,
                 ls_product-MAKTX.
      endloop.
    endif.
    FUNCTION Z_TEST.
    *"*"Update Function Module:
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(IV_MATID) TYPE  /SAPAPO/MATID
    *"     VALUE(IV_MAKTX) TYPE  /SAPAPO/MAKTX
    *"     VALUE(IV_LANGU) TYPE  LANGU
    data: itab type standard table of zupdate,
    wa_itab type zupdate.
    wa_itab-matid = iv_matid.
    wa_itab-maktx = iv_maktx.
    wa_itab-langu = iv_langu.
    append wa_itab to itab.
    update zupdate from table itab .
    ENDFUNCTION.
    Edited by: ka reddy on Sep 24, 2009 4:14 PM
    Edited by: ka reddy on Sep 24, 2009 4:15 PM
    Edited by: ka reddy on Sep 24, 2009 4:16 PM
    Edited by: ka reddy on Sep 24, 2009 4:17 PM
    Edited by: ka reddy on Sep 24, 2009 4:21 PM

    Hey Naimesh thanks for the reply. yeah i read that document way before and i started taking a stab at implementing it.
    I started with update task to see how it behaves and then wanted to go with BGRFC tats when i had the update issue.
    Now that am done with update i want to implement BGRFC.
    I have modified the earlier prgm...Can you give me some ideas how to extend this? Thanks!
    *&  Include           ZBGRFC_INBOUND_TEST
    Report: ZBGRFC_INBOUND_TEST.
    DATA: l_dest     TYPE REF TO if_bgrfc_destination_inbound,
          l_unit     TYPE REF TO if_trfc_unit_inbound,
          l_inb_dest TYPE bgrfc_main_i_dst,
          lv_matid TYPE /sapapo/matid,
          lv_matnr TYPE /sapapo/matnr,
          lv_maktx type /SAPAPO/MAKTX,
          lv_matid1 TYPE /sapapo/matid,
          lv_matnr1 TYPE /sapapo/matnr,
          lv_maktx1 type /SAPAPO/MAKTX,
          lv_langu1  TYPE LANGU,
          lv_langu  TYPE LANGU.
    data: lt_product type  STANDARD TABLE OF ZUPDATE,
          ls_product type ZUPDATE.
    lv_matid = '125'.
    lv_langu = 'E'.
    lv_maktx = 'Materia3'.
    **--Get the inbound destination for BGRFC.
      IF l_inb_dest IS INITIAL.
          SELECT SINGLE * FROM bgrfc_main_i_dst INTO l_inb_dest.
        ENDIF.
        l_dest = cl_bgrfc_destination_inbound=>create( l_inb_dest-destination ).
        l_unit = l_dest->create_trfc_unit( ).
    CALL FUNCTION 'Z_TEST' IN BACKGROUND UNIT l_unit
      EXPORTING
        iv_matid = lv_matid
        iv_maktx = lv_maktx
        iv_langu = lv_langu .
    select * from zupdate into corresponding fields OF TABLE lt_product.
    if sy-subrc <> 0.
      write 'no records added'.
    else.
      loop at lt_product into ls_product.
        write: / ls_product-MATID,
                 ls_product-MAKTX.
      endloop.
    endif.
    Edited by: ka reddy on Sep 24, 2009 5:16 PM

  • Help with Updates

    My son has a Droid Inc2 and has had multiple problems with updates. They always happen overnight and he gets a message telling him to do a battery pull to avoid further messages regarding the update. Each time we eventually have to do a hard reset so that we can restore the service to the phone. This has been happening for quite sometime now starting back in early August.
    The current software running is 3.02.605.1. My wife messaged a VZW Support Rep on Twitter about it and was told it was an old software version and to keep trying to pull the update. We have stopped trying since having to do a reset this weekend. This is really aggravating and I need to know what we should do. Right now if you check for software update it acts like it's checking but then does nothing more. Then in a couple days the phone will try to update overnight.
    Someone please tell me what needs to be done. I have looked thru the oter posts and couldn't find what I needed and got tired of looking at all the pages of posts regarding the updates.
    Thx!

    AntonioC_VZW wrote:
    Hi 2tonpickup,
    I understand your concerns regarding your son's phone. We also value your time and have different processes in place to troubleshoot any issues with your phones. Please keep in mind that this is a peer to peer forum and while our Social Media Team monitors these forums the best way to get assistance troubleshooting a device is to call us at 800-922-0204 from a different phone and have the faulty device fully charged and available when calling.
    Your device includes a one year manufacturer's warranty and we'll be happy to replace it with a Certified Like New unit of the same model if we are unable to resolve your concerns and phone is under warranty. Please visit this LINK for replacement process details.
    To the original poster: Please keep in mind that the Verizon employees are moderators, meaning that they mostly make sure we abide by the rules and regulations of the forums. While they do chime in occationally to help, your best bet is really to call tech support first or to go into a Verizon store.

  • Help with Update failure please

    I have Adobe Photoshop CC running on win 7 64 bit. When doing the latest batch of updates one keeps failing with the error message "Adobe CSXS Infrastructure 4 Installation Failed Error Code U44M1P7" Can anyone help with this?

    Thanks Eshant
    I had since  been researching this on the web and it seems it is a very
    common fault which has not always been fixed by the full re-install
    advocated by Adobe in the link you kindly provided. I therefore decided
    to keep trying for a couple of days before resorting to such a drastic
    solution.
    After several failures to get CSXS Infrastructure 4 to install, both via
    the CC Desktop App and from the "Help" menu within Photoshop CC, I had
    one more try this morning and this time it seems to have installed
    without a hitch. I have no idea why, as I have made no system changes,
    but for now I do seem to have solved the problem as my installation of
    Photoshop CC is now reporting that it is fully up to date.
    Thanks for your response.
    Pixellated

  • Help with updating the grid(CONNECT 4)

    Hi, this a small portion of my connect 4 game program. I have a problem with updating the grid. During the game, whenever I enter a column number for the first time, the program works properly. But when i try to give the same column for the second time, the chip falls in the same row instead of going to the second row. Can anybody help me write the method that will do this.
    This is the method that switches the chip's value(By the way discard the variable 'turn' because that works properly, it is used in another method):
        //Method 2: Updates the matrix
        public static void UpdateMatrix (char location, char turn)
            c.println (location);
            switch (location)
                case '1':
                    matrix [5] [0] = turn;
                    break;
                case '2':
                    matrix [5] [1] = turn;
                    break;
                case '3':
                    matrix [5] [2] = turn;
                    break;
                case '4':
                    matrix [5] [3] = turn;
                    break;
                case '5':
                    matrix [5] [4] = turn;
                    break;
                case '6':
                    matrix [5] [5] = turn;
                    break;
                case '7':
                    matrix [5] [6] = turn;
                    break;
        } //End Method 2Can anybody describe me how to write a method or write a method that will tell the computer to assign the chip to the next row. You an edit my method if u want to. THANX A LOT!!!

    HERE IS THE METHODS SO FAR!
        //Method 3: Checks if assigned place for the chip has a chip there already
        public static void emptyspot (int column, int row)
            for (row = 5 ; row >= 0 ; row--)
                for (column = 0 ; column <= 6 ; column++)
                    if (matrix [row] [column] == 'X' || matrix [row] [column] == 'O')
                        row--;
        }I AM GETTING AN ERROR!!! AT THE BOTTOM OF MY PROGRAM! SOMEBODY HELP!
    Message was edited by:
    Taufiq

  • I NEED SOME HELP WITH UPDATING MY IPOD TOUCH PLEASE

    i need some help with my ipod the version is 3.1.3 and every time I'm trying to update it says it can not be restored then it says unknown error so i need some help updating my ipod to version 4.2

    If you mean you're trying to update your ios go to settings/general/software update. then you should see the latest ios just tap it and it will automatically update your ipod. If you're trying to restore your ipod (as it's not quite clear in your query) try doing it through itunes instead of on the device itself

  • Help with update statement

    Create table temp_sibs as
    (select 1701 sib_1, 1702 sib_2 from dual
    union all
    select 1171,1172 from dual
    union all
    select 1701,1172 from dual
    union all
    select 1171,1174 from dual
    union all
    select 1173,1176 from dual
    union all
    select 2001,2004 from dual
    union all
    select 2001,2006 from dual
    union all
    select 2002,2006
    from dual)
    create table temp_sib_data as
    (select 111 pid, 1701 sibid, 5 amt from dual
    union all
    select 111 pid, 1176 sibid, 5 from dual
    union all
    select 222 pid, 2006 sibid, 5 from dual
    union all
    select 333 pid, 2001 sibid, 5 from dual
    union all
    select 333 pid, 2002 sibid, 5 from dual
    union all
    select 333 pid, 1171 sibid, 5 from dual
    First table is a lookup table that defines relationships sib_1 is related to sib_2
    Second table consists of a column pid and column sibid which is either sib_1 or sib_2
    The user would pass parameter pid and sibid and I want to update all the related rows with any matching sibid to 0.
    It is like 1701 matches with 1702 and 1701 matches with 1174 so indirectly 1701 and 1174 match...and 1171 matches because
    1171 matches with 1174
    so all 1701,1702,1171,1172, 1173,1174,1176 match (indirectly with each other)
    So for example if the user passes 333 pid and 2001 rows with 333,2001 and 333,2002 should update the amt to 0
    and if the user passes 111 and 1176 than 1st 2 rows should be updated to 0.

    Hi,
    try this:
    DEFINE PID='333'
    DEFINE sibid='2001'
    -- SELECT is only for test.
    -- Replace SELECT with: UPDATE TEMP_SIB_DATA SET AMT = 0
    SELECT * FROM TEMP_SIB_DATA  
    WHERE  PID = &PID   AND  SIBID IN (
           WITH TEMP AS(
                SELECT SIB_1, SIB_2 FROM TEMP_SIBS
                   START WITH     SIB_1 = &&SIBID   OR  SIB_2 = &&SIBID
                   CONNECT BY NOCYCLE      PRIOR SIB_2 = SIB_1  
                                       OR  PRIOR SIB_1 = SIB_2  
                                       OR  SIB_2 = PRIOR SIB_2  
                                       OR  SIB_1 = PRIOR SIB_1
            SELECT SIB_1 FROM TEMP
            UNION ALL
            SELECT SIB_2 FROM TEMP
    );For pid=333 and sibid=2001 it returns desired records for update:
    PID                    SIBID                  AMT                   
    333                    2001                   5
    333                    2002                   5For pid=111 and=1176 it returns one row - 1176 matches only with 1173 and 1173 doesn't match with any other rows,
    so only 5th row, not first 2, should be updated ... maybe I missed something ?
    PID                    SIBID                  AMT
    111                    1176                   5

  • Help with update to 2.3

    can anyone help with my x10 im unable to update to android 2.3 my phone just says you already have the latest softwere!!!! its driving me insane...

    Unfortunately that generally means that the network/country that your handset was manufactured for has not yet passed approval on the 2.3 update. With this being the case there is little that I can advise you do to resolve this until acceptance has been passed on this update.
     - Official Sony Xperia Support Staff
    If you're new to our forums make sure that you have read our Discussion guidelines.
    If you want to get in touch with the local support team for your country please visit our contact page.

  • Help with Update Record

    I am using DW 8. Have built an access database that I can
    retrieve records from, click on a unique ID and bring up the
    details of the record, however when I submit the updates, I get an
    80040e30 error with a message that the execute line
    MM_editCmd.Execute(); is having the problem. I tried to do an
    insert record just to test and got the exact same result.
    Any help would be appreciated. I have to get this done by
    Monday!
    Regards,

    Are the permissions set correctly on the folder holding the
    DB and are you
    by chance using any reserved words in the field names?
    "Bochee" <[email protected]> wrote in
    message
    news:es9e5r$lj2$[email protected]..
    >I am using DW 8. Have built an access database that I can
    retrieve records
    > from, click on a unique ID and bring up the details of
    the record, however
    > when
    > I submit the updates, I get an 80040e30 error with a
    message that the
    > execute
    > line MM_editCmd.Execute(); is having the problem. I
    tried to do an insert
    > record just to test and got the exact same result.
    >
    > Any help would be appreciated. I have to get this done
    by Monday!
    >
    > Regards,
    >

Maybe you are looking for