Sequential search then update record

Hi guys,
I have an issue with the following tables. I am just a beginner using oracle. LRS_ID is the unique field. BMP is Beginning Mile Point and EMP is End Mile Point. Table 1 shows a sample of how my data is.
Table 1
LRS_ID            BMP     EMP
014001101100     0.00     1.19
014001101100     1.19     1.28
014301101100     2.65     6.11
014301101100     8.42     11.21
014301101100     11.21     13.67
014301101100     17.02     17.44
014501102100     0.00     0.51
014501102100     2.10     4.96
014601102100     0.00     7.13
014601102100     7.13     7.46
014601102100     7.46     9.82
014601102100     9.82     9.91
014601102100     9.91     10.56
014601102100     10.56     13.47
014601102100     14.15     17.42
Table 2
LRS_ID             BMP     EMP
014001101100     0.00     1.28
014301101100     2.65     6.11
014301101100     8.42     13.67
014301101100     17.02     17.44
014501102100     0.00     0.51
014501102100     2.10     4.96
014601102100     0.00     13.47
014601102100     14.15     17.42Table 2 shows what I need to do. For each unique LRS_IDs I need to go through the BMP and EMP for each row. If the EMP for the first record is equal to the BMP of the second record keep going until there is a change. If there is no change I should only have ONE BMP and ONE EMP for that LRS_ID. BMP should be the lowest Milepoint and EMP should be the highest.
If there is a discrepancy I need to keep that as a unique record. However, I do need to get the min and max for the ones that matched upto that point.
I am really confused as to how I can go about solving this using SQL.
Any guidance or logic will be very much appreciated

SQL> select * from tab_1 order by 1,2,3;
LRS_ID                      BMP        EMP
014001101100                  0       1.19
014001101100               1.19       1.28
014301101100               2.65       6.11
014301101100               8.42      11.21
014301101100              11.21      13.67
014301101100              17.02      17.44
014501102100                  0        .51
014501102100                2.1       4.96
014601102100                  0       7.13
014601102100               7.13       7.46
014601102100               7.46       9.82
014601102100               9.82       9.91
014601102100               9.91      10.56
014601102100              10.56      13.47
014601102100              14.15      17.42
15 rows selected.
SQL> select lrs_id, min(bmp) bmp, max(emp) emp from (
  2  select lrs_id, bmp, emp, diff, sum(diff) over(partition by lrs_id order by bmp
  3  rows between current row and unbounded following) sm
  4  from (
  5  select lrs_id, bmp, emp,
  6  (lead(bmp,1,emp) over(partition by lrs_id order by bmp) - emp) diff
  7  from tab_1
  8  )
  9  )
10  group by lrs_id, sm
11  order by 1,2
12  /
LRS_ID                      BMP        EMP
014001101100                  0       1.28
014301101100               2.65       6.11
014301101100               8.42      13.67
014301101100              17.02      17.44
014501102100                  0        .51
014501102100                2.1       4.96
014601102100                  0      13.47
014601102100              14.15      17.42
8 rows selected.Rgds.

Similar Messages

  • Updating records

    helloo..
    i have a java application that will add records , search and update records in the database..
    i have the fields id,name,phone,address,sex and dob..
    i will be having an update button , whenever the user will click on the update button he can update the record he wants and then the updated record will be stored..but i don't know how to write the code for this ..
    can any one help me by giving me a sample code...
    this is my application code:
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class Insert3 extends JFrame implements ActionListener
         JTextField id, name,address,phone,sex,dob;
         JButton add,update;
         JPanel panel, buttonPanel;
         static ResultSet res;
         static Connection conn;
         static Statement stat;
         static String[][] tableData;
         JTable dataTable;
         Container c = getContentPane();
         JScrollPane scrollpane;
         //private ImageIcon logo;
    public static void main (String[] args)
              Insert3 worker = new Insert3();
              try
                        //Connect to the database and insert some records:
                             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                             Connection conn = DriverManager.getConnection("jdbc:odbc:database");//database is the DSName
                             stat = conn.createStatement();
                             /*stat.executeUpdate("INSERT INTO Customer VALUES (1001, 'Simpson','hamad town',222,'m','may 72')");
                             stat.executeUpdate("INSERT INTO Customer VALUES (1002, 'McBeal','isatown',333,'f','jan 79')");
                             stat.executeUpdate("INSERT INTO Customer VALUES (1003, 'Flinstone','hamad town',292,'m','may 72')");
                             stat.executeUpdate("INSERT INTO Customer VALUES (1004, 'Cramden','hamad town',987,'m','may 72')");
                             stat.executeUpdate("INSERT INTO Customer VALUES (1004, 'Cramden','hamad town',987,'m','may 72')");
                             stat.executeUpdate("INSERT INTO Customer VALUES (1004, 'Cramden','hamad town',987,'m','may 72')");*/
                   }//try
              catch(Exception e)
                        System.out.println("Caught exception in main: " +e);
                   }//catch
    //Create the JTable and build the GUI..
         worker.updateTable();
         }//main
    //===========================================================================================================================
    void makeGUI()
              c.setLayout(new BorderLayout());
              id = new JTextField(20);
              name = new JTextField(20);
              address=new JTextField(20);
              phone=new JTextField(20);
              sex=new JTextField(20);
              dob=new JTextField(20);
              add = new JButton("ADD");
              update=new JButton("UPDATE");
              panel = new JPanel();
              buttonPanel = new JPanel(new GridLayout(3,4));
              buttonPanel.add(new JLabel("ID",JLabel.CENTER));
              buttonPanel.add(id);
              buttonPanel.add(new JLabel("Name",JLabel.CENTER));
              buttonPanel.add(name);
              buttonPanel.add(new JLabel("Address",JLabel.CENTER));
              buttonPanel.add(address);
              buttonPanel.add(new JLabel("Phone",JLabel.CENTER));
              buttonPanel.add(phone);
              buttonPanel.add(new JLabel("Sex",JLabel.CENTER));
              buttonPanel.add(sex);
              buttonPanel.add(new JLabel("Date Of Birth",JLabel.CENTER));
              buttonPanel.add(dob);
              panel.add(add);
              panel.add(update);
              add.addActionListener(this);
              search.addActionListener(this);
              pack();
              setVisible(true);
         }//makeGUI
    //===========================================================================================================================
    public void actionPerformed(ActionEvent e)
              if(e.getSource() == add)
              if(id.getText().equals("") || name.getText().equals("") || address.getText().equals("") || phone.getText().equals("") || sex.getText().equals("")|| dob.getText().equals(""))
              JOptionPane.showMessageDialog(null,"Please fill in the missing fields","Missing Fields!!!",JOptionPane.INFORMATION_MESSAGE);
                   try
                        String idInput = id.getText();
                        if(idInput.equals(""))
                        idInput = "0";
                        int userId = Integer.parseInt(idInput);
                        String userName = name.getText();
                        String userAddress = address.getText();
                        String userPhone = phone.getText();
                        String userSex = sex.getText();
                        String userDateBirth = dob.getText();
                        //logo=new ImageIcon("C:\My Documents\SENIOR\diagonal.jpg");
                        //Image img = Toolkit.getDefaultToolkit().getImage("diagonal.jpg");
                        String sql = "INSERT INTO CUSTOMER VALUES ('"+userId+"', '"+userName+"', '"+userAddress+"', '"+userPhone+"', '"+userSex+"', '"+userDateBirth+"')";
                        stat.executeUpdate(sql);
                        id.setText("");
                        name.setText("");
                        address.setText("");
                        phone.setText("");
                        sex.setText("");
                        dob.setText("");
                        updateTable();
                        repaint();
    }//try
                   catch(Exception ee)
                        System.out.println("Caught exception in actionPerformed: "+ee);
                   }//catch
    }//if
    if(e.getSource()==update)
                   String idEntered = id.getText();
                   String enteredName=name.getText();
                   String enteredPhone=phone.getText();
                   String enteredSex=sex.getText();
                   String enteredDob=dob.getText();
                   try
                   catch(Exception eee)
                                       System.out.println("Caught exception in actionPerformed: "+eee);
                   }//catch
         }//else
         }//actionlistener
    //===========================================================================================================================
    void updateTable()
         try
                   int rowNumbers = 0;
                   //Get the number of rows in the table so we know how big to make the data array..
                   ResultSet results = stat.executeQuery("SELECT COUNT(*) FROM CUSTOMER");
                   while(results.next())
                             rowNumbers = results.getInt(1);
                        }//while
                   System.out.println("Rows: "+rowNumbers);
                   tableData = new String[rowNumbers][6];
                   int currentRow = 0;
                   ResultSet results1 = stat.executeQuery("SELECT * FROM CUSTOMER");
                   while(results1.next())
                             tableData[currentRow][0] = results1.getString(1);
                             tableData[currentRow][1] = results1.getString(2);
                             tableData[currentRow][2] = results1.getString(3);
                             tableData[currentRow][3] = results1.getString(4);
                             tableData[currentRow][4] = results1.getString(5);
                             tableData[currentRow][5] = results1.getString(6);
                             currentRow++;
                        }//while
    //===============================================
    //Create the table model:
    final String[] colName = {"Id", "Name","Address","Phone","Sex","Date OF Birth"};
    TableModel pageModel = new AbstractTableModel()
         public int getColumnCount()
              return tableData[0].length;
         }//getColumnCount
         public int getRowCount()
              return tableData.length;
         }//getRowCount
    public Object getValueAt(int row, int col)
              return tableData[row][col];
    }//getValueAt
         public String getColumnName(int column)
              return colName[column];
    }//getcolName
         public Class getColumnClass(int col)
              return getValueAt(0,col).getClass();
         }//getColumnClass
         public boolean isCellEditable(int row, int col)
              return false;
    }//isCellEditable
         public void setValueAt(String aValue, int row, int column)
              tableData[row][column] = aValue;
    }//setValueAt
    };//pageModel
    //===========================================================================================================================
    //Create the JTable from the table model:
    dataTable = new JTable(pageModel);
    //===========================================================================================================================
    if(scrollpane != null)
              scrollpane.setVisible(false);
              scrollpane = null;
         }//if
    scrollpane = new JScrollPane(dataTable);
    scrollpane.setVisible(true);
    if(buttonPanel == null)
         makeGUI();
         c.add(buttonPanel, BorderLayout.NORTH);
         c.add(panel, BorderLayout.CENTER);
         c.add(scrollpane, BorderLayout.SOUTH);
         id.grabFocus();
         pack();
    }//try
    catch(Exception e)
    System.out.println("Caught updateTable exception: "+e);
    }//catch
    }//updatetable
    }//Jframe
    i did the add part but know i'm stuck with the update..well this is my first time to work with databases using java ..
    so please can someone help
    thankx

    Yes, I want find out how it works and what was the cause the program could not work.

  • Get error ORA-20505 and ORA-01403 when UPDATING record

    Hi,
    I'm running APEX 3.2.1, on Oracle XE 10.2.0.1, on Sun Ultra20 (Intel-based) running Windows Server 2003.
    I created a small, department database - to keep track of contacts, equipment, etc.
    Initially, I used a NUMBER as the PRIMARY KEY in both the CONTACTS table and EQUIPMENT tables. I created a CONTACTS interactive report and a CONTACT DETAILS form, where the EDIT button on a row in the CONTACTS report brings up the individual record to modify. Same thing for EQUIPMENT - interactive report page and form page.
    This all worked fine!
    Then, I decided to change the PRIMARY KEY for the CONTACTS table to a STRING - with CONTACT_FIRST_NAME and CONTACT_LAST_NAME as the primary key. I figured I this would prevent duplicate entries. After the change, inserts work. Updates work, IF a change is made to ANY field EXCEPT first name or last name.
    UPDATES fail - if user modifies EITHER the first name or last name - in APEX. But, update SUCCEEDS if done in SQL Developer. Obviously, I missing a subtle nuance in APEX, but I can't figure it out.
    I've included DEBUG trace and version information below.
    Thanks,
    Andy
    ORA-20505: Error in DML: p_rowid=Adam1, p_alt_rowid=CONTACT_FIRST_NAME, p_rowid2=Adam, p_alt_rowid2=CONTACT_LAST_NAME. ORA-01403: no data found
    0.02: A C C E P T: Request="SAVE"
    0.02: Metadata: Fetch application definition and shortcuts
    0.02: NLS: wwv_flow.g_flow_language_derived_from=FLOW_PRIMARY_LANGUAGE: wwv_flow.g_browser_language=en-us
    0.02: alter session set nls_language="AMERICAN"
    0.02: alter session set nls_territory="AMERICA"
    0.02: NLS: CSV charset=WE8MSWIN1252
    0.02: ...NLS: Set Decimal separator="."
    0.02: ...NLS: Set NLS Group separator=","
    0.02: ...NLS: Set date format="DD-MON-RR"
    0.02: ...Setting session time_zone to -06:00
    0.02: Setting NLS_DATE_FORMAT to application date format: DD-MON-YYYY
    0.02: ...NLS: Set date format="DD-MON-YYYY"
    0.03: Fetch session state from database
    0.03: ...Check session 1896858759858984 owner
    0.03: Setting NLS_DATE_FORMAT to application date format: DD-MON-YYYY
    0.03: ...NLS: Set date format="DD-MON-YYYY"
    0.03: ...Check for session expiration:
    0.03: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.03: Session: Fetch session header information
    0.03: ...Metadata: Fetch page attributes for application 101, page 21
    0.05: ...Validate item page affinity.
    0.05: ...Validate hidden_protected items.
    0.05: ...Check authorization security schemes
    0.05: Session State: Save form items and p_arg_values
    0.05: ...Session State: Save "P21_CONTACT_FIRST_NAME" - saving same value: "Adam"
    0.06: ...Session State: Saved Item "P21_CONTACT_LAST_NAME" New Value="Adam Jr"
    0.06: ...Session State: Save "P21_CONTACT_COMPANY" - saving same value: "Atempo"
    0.06: ...Session State: Save "P21_CONTACT_JOB_TITLE" - saving same value: "Sr Sw Engr"
    0.06: ...Session State: Save "P21_CONTACT_JOB_ROLE" - saving same value: "Engineering"
    0.06: ...Session State: Save "P21_CONTACT_STATUS" - saving same value: "Active"
    0.06: ...Session State: Save "P21_CONTACT_PRODUCT" - saving same value: ""
    0.06: ...Session State: Save "P21_CONTACT_PHONE" - saving same value: "222-333-4444"
    0.06: ...Session State: Save "P21_CONTACT_MOBILE" - saving same value: ""
    0.06: ...Session State: Save "P21_CONTACT_FAX" - saving same value: ""
    0.06: ...Session State: Save "P21_CONTACT_EMAIL" - saving same value: ""
    0.06: ...Session State: Save "P21_CONTACT_STREET" - saving same value: ""
    0.06: ...Session State: Save "P21_CONTACT_CITY" - saving same value: ""
    0.06: ...Session State: Save "P21_CONTACT_STATE" - saving same value: "CO"
    0.06: ...Session State: Save "P21_CONTACT_ZIP" - saving same value: ""
    0.06: ...Session State: Save "P21_CONTACT_COUNTRY" - saving same value: "United States"
    0.06: ...Session State: Save "P21_CONTACT_NOTES" - saving same value: ""
    0.06: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.06: Branch point: BEFORE_COMPUTATION
    0.06: Computation point: AFTER_SUBMIT
    0.06: Tabs: Perform Branching for Tab Requests
    0.06: Branch point: BEFORE_VALIDATION
    0.06: Perform validations:
    0.08: ...Item in validation equals expression 2: P21_CONTACT_JOB_ROLE
    0.08: ...Item in validation equals expression 2: P21_CONTACT_STATUS
    0.08: ...Item Not Null Validation: P21_CONTACT_PHONE
    0.08: ...Item in validation equals expression 2: P21_CONTACT_STATE
    0.08: ...Item in validation equals expression 2: P21_CONTACT_COUNTRY
    0.08: Branch point: BEFORE_PROCESSING
    0.08: Processing point: AFTER_SUBMIT
    0.08: ...Process "Process Row of ISR_CONTACTS": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:ISR_CONTACTS:P21_CONTACT_FIRST_NAME:CONTACT_FIRST_NAME:P21_CONTACT_LAST_NAME:CONTACT_LAST_NAME|IU
    0.08: Show ERROR page...
    0.08: Performing rollback...
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Database     
    NAME     XE
    CREATED     06/08/2010 05:22:50 PM
    RESETLOGS_TIME     07/09/2010 10:09:59 AM
    PRIOR_RESETLOGS_CHANGE#     193066
    PRIOR_RESETLOGS_TIME     06/08/2010 05:22:52 PM
    LOG_MODE     ARCHIVELOG
    CHECKPOINT_CHANGE#     4436025
    ARCHIVE_CHANGE#     4387159
    OPEN_RESETLOGS     NOT ALLOWED
    VERSION_TIME     07/09/2010 10:08:44 AM
    OPEN_MODE     READ WRITE
    PROTECTION_MODE     MAXIMUM PERFORMANCE
    PROTECTION_LEVEL     MAXIMUM PERFORMANCE
    REMOTE_ARCHIVE     ENABLED
    DATABASE_ROLE     PRIMARY
    ARCHIVELOG_CHANGE#     4458138
    SWITCHOVER_STATUS     SESSIONS ACTIVE
    DATAGUARD_BROKER     DISABLED
    GUARD_STATUS     NONE
    FORCE_LOGGING     NO
    CGI Environment     
    PLSQL_GATEWAY     WebDb
    GATEWAY_IVERSION     2
    SERVER_SOFTWARE     Oracle Embedded PL/SQL Gateway/10.2.0.1.0
    GATEWAY_INTERFACE     CGI/1.1
    SERVER_PORT     8080
    SERVER_NAME     XDB HTTP Server
    REQUEST_METHOD     GET
    QUERY_STRING     p=4500:36:1896858759858984:::::
    PATH_INFO     /f
    SCRIPT_NAME     /apex
    REMOTE_ADDR     10.135.65.180
    SERVER_PROTOCOL     HTTP/1.1
    REQUEST_PROTOCOL     tcp
    REMOTE_USER     ANONYMOUS
    HTTP_USER_AGENT     Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19 (.NET CLR 3.5.30729)
    HTTP_HOST     isr-si-project:8080

    Maybe because you're changing primary key...and then updating record with primary key that doesn't exist.

  • Problem with update record, then link to file

    Environment:
    Dreamweaver 8, MySQL, PHP.
    I have a repeating record from my database. I added an Update
    Record server behavior for each search result for the result table.
    I added a button to the form and changed "submit" to "view".
    Pressing "view" is supposed to allow the user to view the detailed
    record information.
    The Update Record server behavior is supposed to do two
    things:
    1) add 1 to the 'numViews' filed of the record's database
    entry when the "view" button is pressed
    2) After updating the numViews field, the form is supposed to
    redirect the user to the detailed record
    I found that depending on how I create the record, I an do
    one of the above 2 behaviors, but not both. HELP!
    To add 1 to the numViews field, I created a form variable
    called incNumViews, which does the following:
    <?php echo $row_rsSearchResults['recipeNumViews']+1; ?>
    Very simple.
    The Update Record ends up changing the form action to the
    following:
    <?php echo $editFormAction; ?>
    Looking at the code for this, I ee the following:
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" .
    htmlentities($_SERVER['QUERY_STRING']);
    But when the "view" (ie: submit" button for the form is
    pressed, I get redirected back to the same repeating record search
    result page, not to the record detail page.
    However, the numViews field in the record is getting properly
    incremented.
    I tried to get around this by changing the Update Record
    behavior "After updating, go to:" field to point to the record
    detail page, and tried passing a parameter tot he recordID I want
    to see details of, as a URL parameter, but that does not work.
    If I change the Update Record form action from
    <?php echo $editFormAction; ?>
    to
    record_detail.php?recordID=<?php echo
    $row_rsSearchResults['recordID']; ?>
    Then I am able to link to the detail page, but NOT update the
    numViews field.
    HOW can I fix this to both update the record, then jump to
    the detail page with a URL parameter being passed, when I click the
    "view" (submit) button o the form??
    Thanks in advance.

    If the user's computer doesn't know what to do with a TIFF file, I guess that Open button would be missing.  Tiff is not a web normal file format, or even a common one for graphics applications....

  • HT4623 that's a nice article about updates, however my IPAD (original) does not have the button to search for updates... what then?

    can someone please direct me to original ipad update info- there is no "search for updates" button in settings, I think we bought the first ipad ever made...

    iOS 5: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
     Cheers, Tom

  • Update more then one records in join

    How to update more then one records in join query.
    means each reocrds have different value.
    Thanks

    Can you give an example to illustrate your question?

  • LiveCycle Designer 8-scripting search Access DB records

    Hi
    I am new to LiveCycle Designer 8 having it included with Acrobat Pro 8. I have been trying to set up a basic form that can interact with an Access 2007 DB. Following the help guide, online tutorials, I have been able to set up the data connection, figure out how to establish a "trusted environment" and added several buttons as a test. Using JS, the next, previous, update, first and last buttons work, populating the form fields with the sample DB data and updating the DB (update). Can't get the add new record button to work even though the JS scripting is precisely that shown in the same tutorials for the other buttons. If I delete the text in the on screen cells in the .pdf form, enter new text, click add, all that I added disappears. Checking the DB, nothing has been added. Same difficulty with deleting a record, and the current opened record does not delete.
    Reading a posting suggesting setting up an SQL query instead, leaving of any auto-incrementing item (like ID), and using the JS scripting for the button (don't yet know how to use SQL for next, previous, update, etc.), still couldn't get the add new or delete to work. Tried every combo of no user name, no password to user name, password blank, etc. No success.
    The other needed capability for the test form is the ability to search the DB records, for example by name or ID, for example by the user entering a name or ID in a text input box, clicking a "search" button and the record (if it exists) displaying in the other cells. Then, once found, it could be updated or deleted. One tutorial aims to populate a drop down list box with the data from a specific DB column. It doesn't use JS, rather FormCalc (which kept generating error messages, when I tested it out))and is far too complex for my limited novice skills. If I could display a drop down list box with all of the names and ID's in a DB, the user could choose one and once the record would populate the cells, they could update or delete it.
    So, I'm stuck. Can't get the add new or delete to work and can't figure out how to set up a search to identify records for update or delete. I've read and read anything I can find online, in the Adobe knowledge base, forum, blog postings, trying out many ideas without any success.
    I am hoping someone can help with some suggestions, sample scripts, hopefully understandable by a beginner.
    Any help would be appreciated.
    Kind Regards,
    Stephen
    [email protected]

    Here are some good blog entries
    http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/
    http://forms.stefcameron.com/2006/09/29/selecting-specific-database-records/
    I also did a tech talk for the Acrobat Users Group where we talked about Database connectivity. Here is a link to that webinar for the replay
    http://adobechats.adobe.acrobat.com/p69655795/
    Paul

  • This window service has timer for update record once in a day at 5 pm.

    Hi Guys Please help me.
    Actully i create a window service. This window service has timer for update record once in a day at 5 pm.
    I have write a code but it is not working fin
    Here is my code.
    App.Config File:-
    <appSettings>  
        <add key="IsTrace" value="YES"/>
        <add key="SourceServerPath" value="Server=DATASERVER\SQL2008R2;database=WDSBHN;User ID=Wireless;pwd=chetu@123"/>
        <add key="ArchiveServerPath" value="Server=CHETUIWK091\SQL2008R2;database=Demo;User ID=sa;pwd=Chetu@123"/>
        <add key="ReportHour" value="22"/>
        <add key="ReportMinut" value="01"/>
        <add key="ReportSecond" value="20"/>
        <add key="ReportMilisecond" value="230"/>
        <add key="DailyTimer" value="tmrProductionDataTransfer"/>
        <add key="MonthlyTimer" value="tmrProductionCleanUp"/>
        <add key="ActionParameter" value="WDS-DataTransfer"/>
      </appSettings>   
    Vb.Net Code:-
    Protected Overrides Sub OnStart(ByVal args() As String)
            ' Add code here to start your service. This method should set things
            ' in motion so your service can do its work.
            Try
                LoggingTracing.WriteTrace("DataTransfer Service START " & Now.ToLongDateString & " " & Now.ToLongTimeString())
                '***Get the Time of service run
                Dim svcRunTime As System.DateTime = Configuration.ConfigurationManager.AppSettings("ServiceRunTime")
                '***differance of these two time
                Dim ts As TimeSpan = DateTime.Now.Subtract(svcRunTime)
                '***production data transfer
                tmrProductionDataTransfer.Enabled = True
                tmrProductionDataTransfer.Interval = 1000
                tmrProductionDataTransfer.Start()
            Catch ex As Exception
                LoggingTracing.WriteError(ex.ToString())
            End Try
        End Sub
    Private Sub tmrProductionDataTransfer_Elapsed(sender As Object, e As Timers.ElapsedEventArgs) Handles tmrProductionDataTransfer.Elapsed
            Try
                Dim time As Date = Date.Now
                Dim currHour As Integer
                Dim currMinute As Integer
                Dim currnSecond As Integer
                Dim reportHour As Integer
                Dim reportMinute As Integer
                Dim reportSecond As Integer
                Dim reportMiliSecond As Integer
                Dim actionParameter As String = Configuration.ConfigurationManager.AppSettings("ActionParameter")
                Dim actionTimerName As String = Configuration.ConfigurationManager.AppSettings("DailyTimer")
                currHour = time.Hour
                currMinute = time.Minute
                currnSecond = time.Second
                reportHour = Convert.ToInt32(Configuration.ConfigurationManager.AppSettings("ReportHour"))
                reportMinute = Convert.ToInt32(Configuration.ConfigurationManager.AppSettings("ReportMinut"))
                reportSecond = Convert.ToInt32(Configuration.ConfigurationManager.AppSettings("ReportSecond"))
                reportMiliSecond = Convert.ToInt32(Configuration.ConfigurationManager.AppSettings("ReportMilisecond"))
                If currHour = reportHour AndAlso currMinute = reportMinute AndAlso currnSecond = reportSecond Then
                    ObjProductionDataTransfer.CopyDataToArchiveServerDayWiseDL(Configuration.ConfigurationManager.AppSettings("SourceServerPath"), Configuration.ConfigurationManager.AppSettings("ArchiveServerPath"),
    actionTimerName, time, actionParameter)
                End If
            Catch ex As Exception
                LoggingTracing.WriteError(ex.ToString())
            End Try
        End Sub
    It is running at 5 pm , but run 3 times, for that records has updated 3 time 
    How i can resolve it, If any problem in this code please give me the write direction or code. And this thing i have been searching for 3 days , but stile i didn't get any solution
    sonesh

    Sonesh,
    Sorry but you have posted to a forum that deals exclusively with questions/issues about customizing and programming Microsoft Project, a planning and scheduling application. I suggest you delete this post and find a more appropriate forum.
    John

  • Check new username on update record

    I used the update form wizard to update records.
    I am giving the user an option to change his/her username
    from this form.
    The "check username" server behavior is only valid if I do an
    insert record, not an update.
    Is there a way to combine them? I've search and found
    nothing.

    David Powers wrote:
    > danilocelic AdobeCommunityExpert wrote:
    >> I haven't done it, but I assume that it does work.
    If it doesn't, then
    >> you'll need to hand code it, and I'd start off with
    looking at the
    >> check new user name code as a basis.
    >
    > The Check New Username server behavior (at least in PHP
    MySQL) is
    > appallingly bad. It does the job, but sends the user to
    a new page,
    > thereby losing all input data. In my "Essential Guide to
    DW CS3", I show
    > how to combine the Check New Username and Insert Record
    server behaviors
    > to work in a more user-friendly way. I also show how to
    apply the same
    > technique to an update form.
    Thanks for bringing this up David. Also, this issue is
    neither specific to this particular script nor limited to
    Dreamweaver generated scripts. Most form processing scripts that
    have any server side validation will have this same issue -- how to
    limit what the user has to reenter to correct whatever the
    particular issue was found. Not that you can't work around it, and
    it's fairly easy to work around (as I'm sure the examples in your
    book make it), if you know what you're doing.
    Danilo Celic
    |
    http://blog.extensioneering.com/
    | WebAssist Extensioneer
    | Adobe Community Expert

  • Error in updating records brought by LOV

    Hi everybody
    I am using Oracle 10 g
    when fetching data from the database by choosing a specific record from LOV then trying to make "save" means "commit" I have this error
    FRM-40509: Oracle error: unable to update record
    I think there is a problem in mapping btw the record in the form and the cursor pointing to that record in the database because when i execute "next_recod" button after choosing one in LOV it go to the record next the one specified before choosing from LOV
    knowing that updating process working correctly when choosing by ("first_record, previous_record, next_record or last_record)
    so what is the solution
    please help
    thank you very much

    yes please
    I didn't know what do you mean by customized or default menu
    I build LOV using the wizard and bind it by a query to a table then make Show_LOV from the form
    so when I choose one of the rows and they brought to the text boxes assigend to them after that when I make "Commit" I got that error
    thank you for help
    and sorry for bieng late in reply, I don't have enternet after 2:00 pm

  • Merge to Insert or update records in SQL Database

    Hello ,
    I am having hard time with creating a Stored Procedure to insert/update the selected records from Oracle data base to SQL database using BizTalk.
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF]
    @dp_id char(32),
    @dv_id char(32),
    @em_number char(12),
    @email varchar(50),
    @emergency_relation char(32),
    @option1 char(16),
    @status char(20),
    @em_id char(35),
    @em_title varchar(64),
    @date_hired datetime
    AS
    BEGIN
    SET NOCOUNT ON;
    MERGE [dbo].[em] AS [Targ]
    USING (VALUES (@dp_id, @dv_id , @em_number, @email, @emergency_relation, @option1, @status, @em_id, @em_title, @date_hired))
    AS [Sourc] (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired)
    ON [Targ].em_id = [Sourc].em_id
    WHEN MATCHED THEN
    UPDATE SET dp_id = [Sourc].dp_id,
    dv_id = [Sourc].dv_id,
    em_number = [Sourc].em_number,
    email = [Sourc].email,
    emergency_relation = [Sourc].emergency_relation,
    option1 = [Sourc].option1,
    status = [Sourc].status,
    em_title = [Sourc].em_title,
    date_hired = [Sourc].date_hired
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title,date_hired)
    VALUES ([Sourc].dp_id, [Sourc].dv_id, [Sourc].em_number, [Sourc].email, [Sourc].emergency_relation, [Sourc].option1, [Sourc].status, [Sourc].em_id, [Sourc].em_title, [Sourc].date_hired);
    END;
    I am getting an error like
    WcfSendPort_SqlAdapterBinding_
    TypedProcedures_dbo_Custom" with URL "mssql://abc//def?". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.Data.SqlClient.SqlException (0x80131904): Procedure or function 'uspInsertorUpdateINF'
    expects parameter '@dp_id', which was not supplied
    I cannot give the Oracle Database name directly in the stored Procedure
    I am stuck with this, and cannot figure out since I am new to SQL Queries and Stored Procedures. Any help is greatly appreciated.
    Thanks

    Hi sid_siv,
    Only the first record is inserted because of the scalar variables of the stored procedure(SP), when you call the SP, only one row is passed. To get all rows inserted, you can either declare a
    table-valued parameter
    (TVP) for the SP or using an Oracle linked server in the SP.
    Create a stored procedure with a table-valued parameter
    As you mentioned linked server is not good in your case, then TVP SP can be the only option. Regarding how to call a SP with TVP parameter in BizTalk, that's a typically BizTalk question then. I would suggest you post your question in a dedicated
    BizTalk Server forum. It is more appropriate and more experts will assist you.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How can I update record in the block that Data Source is PROCEDURE?

    I like use Procedure as the Data Source of block.It's very flexible.
    Usually I do this only query the record,but now I must update record in the block that Data Source is Procedure.
    What next step can I do?Can anyone offer some examples?
    This is example, you goto
    http://www.2shared.com/file/1923834/e0b65fb7/Example.html
    Wait about 30 sec, Click "Save file to your PC: click here",and then you can download it.

    <p>I have written an article about some advanced Forms features.
    Have a look at the 2.3.2 paragraph</p>
    Francois

  • Officejet 6700 error while searching for updates: 'Printer could not connect to server'

    I recently purchase the Officejet 6700 Premium. While setting the printer up, I received the error 'The printer could not connect to the server.' I first received this while the printer was searching for updates. I later received the same error while trying to set up ePrint from my computer.
    The printer is connected through my wireless router. All other print services function normally. It is connected to the network, and I have printed several times over the wireless network.
    Though I don't think it matters, since the on-board print set-up gave me the error, I run Windows 7 64-bit on my computer.
    Thanks for any help!

    What is the IP address of the printer?  What is the make and model of the router that you use in the wireless set up? Is the router firmware up to date? 
    I would first try power cycling the router and the printer. Turn off/unplug the router and then power down the printer. Then plug the router back in and wait for it to be fully up and functioning before turning the printer back on.  After you have both pieces of equipment back on and functioning attempt to connect to web services again.
    If still having problems I would attempt to set a static DNS on the printer through the embedded web server (EWS) by entering the printer's IP address into the address bar of  a browser on a computer. 
    Once that computer displays that page click on the Network tab.
    Then look in the column to the left and find the Wireless section
    Click on IPv4
    Then on that page look at the 2nd section that is labeled DNS Address configuration
    Change the radio button to the manual option
    Then for the manual preferred fill it out and make sure it reads 8.8.8.8
    Secondary should be set to 8.8.4.4
    Then hit Apply
    Read the next screen carefully. That message with the "OK" button below it  is one that states to click that button to undo the changes you  just made.  Just navigate away from that page by clicking on another tab.
    Then reattempt to connect to web services.  
    I am a former employee of HP...
    How do I give Kudos?| How do I mark a post as Solved?

  • I have mac osx 10.6.8 and I keep getting update notices that do nothing, just search for update server. Happens every day. What can you or I do to fix this?

    I have mac osx 10.6.8 and I keep getting update notices that do nothing, just search for update server. Happens every day. What can you or I do to fix this? Other people I work with and use macs have the same issue.

    If you have problems with updating or with the permissions then easiest is to download the full version and trash the currently installed version to do a clean install of the new version.
    Download a new copy of the Firefox program and save the DMG file to the desktop
    * Firefox 6.0.x: http://www.mozilla.com/en-US/firefox/all.html
    * Trash the current Firefox application to do a clean (re-)install
    * Install the new version that you have downloaded
    Your profile data is stored elsewhere in the Firefox Profile Folder, so you won't lose your bookmarks and other personal data.
    * http://kb.mozillazine.org/Profile_folder_-_Firefox

  • Update Record Field if Value Not Equal

    Hello All,
    I am using Toad for Oracle 10. I have a MERGE INTO Process that updates tbl_requisition based on FK - fk_allotment_id that equals parent table tbl_allotment PK - pk_allotment_id. Both tables have create, update and deletes triggers. The process is executed when a Apply Changes/update button is clicked from tbl_allotment. So, all the record data from tbl_allotment updates tbl_requisition record if the fk and pk keys are equal. My problem is if a record is updated within tbl_requisition. Now the record from tbl_requisition is different from tbl_allotment. If any value is updated from tbl_allotment for the matching pk_allotment_id = fk_allotment_id record from tbl_requisition. tbl_allotment record data will override the updated value within tbl_requisition. I would like to only update the values that were updated/changed and are not equal from tbl_allotment to tbl_requisition. Can anyone assist me with this?
    Begin
    MERGE INTO tbl_requisition req
    USING tbl_allotment alt
    ON (req.fk_allotment_id = alt.pk_allotment_id)
    WHEN MATCHED THEN
    UPDATE SET
         req.FK_JOBCODE_ID = alt.FK_JOBCODE_ID,
         req.FK_JOBCODE_DESCR = alt.FK_JOBCODE_DESCR,
         req.FK_JOBCODE_PAYRANGE = alt.FK_JOBCODE_PAYRANGE,
         req.FK_PAY_RANGE_LOW_YEARLY = alt.FK_PAY_RANGE_LOW_YEARLY,
         req.FK_DEPARTMENT_ID = alt.FK_DEPARTMENT_ID,
         req.FK_DIVISION_ID = alt.FK_DIVISION_ID,
         req.FK_NUMBER_OF_POSITIONS = alt.NUMBER_OF_POSITIONS,
         req.FK_DEPARTMENT_NAME = alt.FK_DEPARTMENT_NAME,
         req.FK_DIVISION_NAME = alt.FK_DIVISION_NAME,
         req.REPORT_UNDER = alt.REPORT_UNDER;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        dbms_output.put_line('No data found');
    End; Thanks for reading this thread and I hope someone can provide some assistance. If the create tables or anything is needed that is not a problem to provide.

    Thanks for responding Frank and providing the EXCEPTION information also. Here are my create tables and insert statement. I changed the child table from tbl_requisition to tbl_allotment_temp, same process though.
    CREATE TABLE  "TBL_ALLOTMENT"
       (     "PK_ALLOTMENT_ID" NUMBER,
         "FK_DEPARTMENT_ID" VARCHAR2(5),
         "FK_DIVISION_ID" VARCHAR2(100),
         "FK_JOBCODE_ID" NUMBER,
         "FK_JOBCODE_DESCR" VARCHAR2(100),
         "FK_JOBCODE_PAYRANGE" NUMBER(*,0),
         "FK_PAY_RANGE_LOW_YEARLY" NUMBER(*,0),
         "NUMBER_OF_POSITIONS" NUMBER,
          CONSTRAINT "PK_ALLOTMENT_ID" PRIMARY KEY ("PK_ALLOTMENT_ID") ENABLE
    CREATE TABLE  "TBL_ALLOTMENT_TEMP"
       (     "PK_ALLOTMENT_TEMP_ID" NUMBER,
         "FK_DEPARTMENT_ID" VARCHAR2(5),
         "FK_DIVISION_ID" VARCHAR2(100),
         "FK_JOBCODE_ID" NUMBER,
         "FK_JOBCODE_DESCR" VARCHAR2(100),
         "FK_JOBCODE_PAYRANGE" NUMBER(*,0),
         "FK_PAY_RANGE_LOW_YEARLY" NUMBER(*,0),
         "NUMBER_OF_POSITIONS" NUMBER,
          CONSTRAINT "PK_ALLOTMENT_TEMP_ID" PRIMARY KEY ("PK_ALLOTMENT_TEMP_ID") ENABLE
    INSERT INTO tbl_allotment
    (FK_DEPARTMENT_ID, FK_DIVISION_ID, FK_JOBCODE_ID, FK_JOBCODE_DESCR,
    FK_JOBCODE_PAYRANGE, FK_PAY_RANGE_LOW_YEARLY, NUMBER_OF_POSITIONS)
    values
    (00002, 0000220000, 100408, 'Revenue Analyst',
      2210, 38389, 5);Once data is created for tbl_allotment, this insert statement inserts the data to tbl_allotment_temp.
    INSERT INTO tbl_allotment_temp(
         PK_ALLOTMENT_TEMP_ID,
         FK_JOBCODE_ID,
         FK_JOBCODE_DESCR,
         FK_JOBCODE_PAYRANGE,
         FK_PAY_RANGE_LOW_YEARLY,
         FK_DEPARTMENT_ID,
         FK_DIVISION_ID,
         NUMBER_OF_POSITIONS)
        VALUES (
         :P3_PK_ALLOTMENT_ID,
         :P3_FK_JOBCODE_ID,
         :P3_FK_JOBCODE_DESCR,
         :P3_FK_JOBCODE_PAYRANGE,
         :P3_FK_PAY_RANGE_LOW_YEARLY,
         :P3_FK_DEPARTMENT_ID,
         :P3_FK_DIVISION_ID,
         :P3_NUMBER_OF_POSITIONS);Once any update occurs to tbl_allotment, this process updates tbl_allotment_temp based on temp.pk_allotment_temp_id = alt.pk_allotment_id.
    Begin
    MERGE INTO tbl_allotment_temp temp
    USING tbl_allotment alt
    ON (temp.pk_allotment_temp_id = alt.pk_allotment_id)
    WHEN MATCHED THEN
    UPDATE SET
         temp.FK_DEPARTMENT_ID = NVL (alt.FK_DEPARTMENT_ID, temp.FK_DEPARTMENT_ID),
         temp.FK_DIVISION_ID = NVL (alt.FK_DIVISION_ID, temp.FK_DIVISION_ID),
         temp.FK_JOBCODE_ID = NVL (alt.FK_JOBCODE_ID,    temp.FK_JOBCODE_ID),
         temp.FK_JOBCODE_DESCR = NVL (alt.FK_JOBCODE_DESCR, temp.FK_JOBCODE_DESCR),
         temp.FK_JOBCODE_PAYRANGE = NVL (alt.FK_JOBCODE_PAYRANGE, temp.FK_JOBCODE_PAYRANGE),
         temp.FK_PAY_RANGE_LOW_YEARLY = NVL (alt.FK_PAY_RANGE_LOW_YEARLY, temp.FK_PAY_RANGE_LOW_YEARLY),
         temp.NUMBER_OF_POSITIONS = NVL (alt.NUMBER_OF_POSITIONS, temp.NUMBER_OF_POSITIONS);
    End;Once the data is created within tbl_allotment the data is also inserted within tbl_allotment_temp. If tbl_allotment_temp.NUMBER_OF_POSITIONS value is changed from 5 to 10 is fine. The problem is when a update occurs within tbl_allotment and the updated field is not NUMBER_OF_POSITIONS. The changed field values from tbl_allotment should only update the field data within tbl_allotment_temp.
    UPDATE tbl_allotment_temp
    SET
    NUMBER_OF_POSITIONS = 10
    UPDATE tbl_allotment
    SET
    FK_JOBCODE_DESCR = 'Revenue Test'Now within tbl_allotment_temp only field FK_JOBCODE_DESCR should be updated to Revenue Test but my MERGE INTO process will update all the field values. So the updated NUMBER_OF_POSITIONS value 10 will now be 5. I would only like to update any changed value from tbl_allotment to tbl_allotment_temp. If any record value from tbl_allotment_temp was changed that value should not be updated from the MERGE INTO Process within tbl_allotment unless those values have been updated within tbl_allotment. Let me know if this is not clear so I can clarity more Frank.
    Edited by: Charles A on Aug 29, 2011 8:41 AM

Maybe you are looking for

  • IOS Music Player MP3 Gapless Playback Problem

    Hi, I've been having this gapless playback issue on iOS now for the past few years, since at least iOS 6 if I can remember correctly. The number one reason I use an iPhone and iOS devices is for gapless playback in the iOS music player. For the last

  • Permissions errors after clean installation of 10.7.2

    hey, I'm sorry for the length of this thread. after upgrading to Lion (via mac app store) from the newest snow leopard, the system's performance had become worst. then, i decided to back up all of my files manually and do a clean install making a lio

  • REFX: display contracts without payment performed

    Hello RE Gurus, I wonder is there any possibility in REFX to display Contracts, which don't have payment for current date yet. For example, I have 3 Commercial lease-out contracts with the same conditions and terms. For the Contract 1 Customer have p

  • Oracle Text and Order By

    In the Portal Search Properties you can turn on Oracle Text Searching. When reading the help page for that page you can follow a link at the bottom to a help page called "Performing a custom search". In the middle of that page there is a section call

  • EP 6.0 SP2 integration with Novell Groupwise

    Hi, I am trying to integrate novell groupwise (email system) with EP 6.0 Collaboration Launch pad.  So user can get all the functionality of CLP.  Rightnow EP6 support only lotus and MS exchange server (out of the box).  Seems we need to write some e