Select and update rownum sender jdbc

Dear all
i am using PI 7.31 sender jdbc adapter.
table(TB_AA)  has 10000 row with pi_stat = 'R'   and then  sender jdbc adapter tried  10 row  in using rownum  every  120 second and update same rownum
but  result of select query and udpate query  were different.  not same record update for selecting data.
co_cd,  memid  is PK.
select co_cd , mem_id,  reg_n  FROM TB_AA  where PI_STAT = 'R' AND rownum <= 10
update  TB_AA  set  PI_STAT = 'S', where  PI_STAT = 'R' and rownum <= 10
query is wrong?  ,  what is correct update query with several PK ?

Hi Arten Solohin.
co_cd,  memid  is Primary Key.
select co_cd , mem_id,  reg_n  FROM TB_AA  where PI_STAT = 'R' AND rownum <= 10
update  TB_AA  set  PI_STAT = 'S', where  PI_STAT = 'R' and rownum <= 10
could you make your query with above my query ?  because i am confusing ORDER BY <your unique id_field>   AND LINE_ID ....
will be highly appreciated  in advance
thanks you very much.

Similar Messages

  • JDBC Sender - Different number of records selected and updated.

    Hi people,
    We have a JDBC -> Abap proxy scenario. The JDBC sender is pooling an Oracle database to retrieve data from a table X, each 30 minutes. The select and update statements in jdbc sender are below
    SELECT FIELD1, FIELD2, FIELD3 FROM MY_TABLE WHERE STATUS = 1
    UPDATE MY_TABLE SET STATUS = 2 WHERE STATUS = 1
    Sometimes the message sent to Abap proxy has, for example, 400 records. Looking at runtime workbench, message monitoring, for the same message there is a log like this
    Channel SENDER_JDBC_CHANNEL: Query executed successfully. Start update
    Channel SENDER_JDBC_CHANNEL: 510 row(s) updated successfully
    Someone has already experienced something like this? How can I handle this to guarantee to update only those read records?
    regards.
    roberti

    Hi All,
    Even we are facing the same problem.
    In our scenario, receiver is SAPR3. (IDOC)
    Will this parameter serialization work in our case?
    1. SELECT XBLNR, WERKS, MATNR, MDV01, BACKFLQUANT, STATUS, SAPTIMESTAMP, PITSTIMESTAMP, PMTIMESTAMP, BATCH FROM PMBPITS.PITS_UNITY WHERE STATUS = '01' and rownum<200 . 
    2. UPDATE PMBPITS.PITS_UNITY SET STATUS = '02' , SAPTIMESTAMP = sysdate WHERE STATUS = '01' and rownum<200  ( currently the value is rownum < 5 )
    Thanks!!
    Regards
    Gouri

  • Select and update in same instruction

    Can i select and update a column in table by one query only
    I donot want to execute two queries one for updation and one for retrieval
    e.g. instead of UPDATE t1 set val=val+1 and then SELECT val from t1;
    i wanna have a single query (compliant to mysql and ORACLE)
    because when i passa query UPDATE t1 set val=val+1; SELECT val from t1; on the command prompt is is fine but when i do so through jdbc it gives me errror
    please help

    Why would a stored procedure change anything?
    The stored procedure would have the UPDATE ... ; SELECT sequence in it.
    Which results in the same "work" the database has to do, compared to sending the two statements via JDBC.
    The only thing that a stored procedure would save, is the second JDBC call, but I doubt that this makes a big difference (provided this is not done in a loop. Then I'd retrieve the new values in one statement after all the updates have been committed)
    So I would simply do Statement statement = connection.createStatement();
    int rows = statement.executeUpdate("UPDATE ....");
    ResultSet rs = statement.executeQuery("SELECT ... ");
    String val = null;
    if (rs.next()) val = rs.getString(1);
    rs.close();The code for the stored procedure would look very similar to this with the disadvantage that that you have to maintain it for every DBMS that has to be supported.

  • Can I use a select and update statement in a single jsp file?

    I want to update the BUY table everytime I would add a SELL transaction.....I want to minus the stocks that I sold to those that Ive bought before.....
    note: I used a seperate table in BUY and SELL transaction
    After I Have added a transaction, I want to update the buy table. This is my problem, can I used both SELECT and UPDATE statement at the same time in a single jsp file for example like this:
    select * from test, test1;
    update test
    set total_shares=total_shares-Stotal;
    where stock_code=Scode AND name_broker=Sbroker;
    Can i have both of these statements in the same jsp file in oder to update the buy table?
    Or can anyone suggest how can process that update?THANKS!
    --------------------

    Can i have both of these statements in the same jsp file in oder to update the buy table?Yes. But wouldn't it have been easier just to try it?

  • Combine select and update into single statement,without bind-variable

    I have a problem, that I think is not possible to solve the way I want to, but I just wanted to check before leaving the idea...
    I am looking for a way to combine the select and the update statement into one single statement. This is what I wan't to achive: select some data, and update the data selected before returning them.
    On this site http://www.psoug.org/reference/update.html I see that the following are possible:
    var bnd1 NUMBER
    var bnd2 VARCHAR2(30)
    var bnd3 NUMBER
    UPDATE employees
    SET job_id ='SA_MAN', salary = salary + 1000,
    department_id = 140
    WHERE last_name = 'Jones'
    RETURNING salary*0.25, last_name, department_id
    INTO :bnd1, :bnd2, :bnd3;
    I need to have this as a single statement, and cannot use bind-variables. So I was hoping that something like this could be possible:
    UPDATE customer c
    SET c.HAS_CREDIT ='1'
    WHERE c.HAS_CREDIT = '0'
    RETURNING c.CUSTOMER_NO, c.FIRSTNAME, c.LASTNAME
    where c.HAS_CREDIT = '1'
    But this doesn't compile, complaining of missing into (ORA-00925: missing INTO keyword). And even though I would like this to be possible because this would solve my current problem, I think it would be very confusing. For instance; would the where clause of the returning part be operating after the update or before?
    Any comments or suggestions on how to get it work in a single statement, or should I just leave this path straight away?

    Hi,
    RETURNING only works with bind variables, see
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/returninginto_clause.htm#sthref3006
    The real problem is that the form of RETURNING clause with bind variables is only valid for single row update or insert statements.
    To update (or insert) multiple rows and return the data, you will need to use
    RETURNING BULK COLLECT INTO clause. See
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2236
    Cheers,
    Colin

  • Select and update leave request data - oracle !!

    Dears,
    We have a very important presentation here to one of our stakeholders and he is interested to see how to submit and update leave requests using Adobe LiveCycle Workspace.
    I have a simple PDF form where the user can choose to submit new leave or update an existing one, if the user choses to update an existing leave he will enter the leave start date and press on a button to retrieve this leave information form the database ( select * from leaves where leave_date=’the entered date’ and requestor=’requestor name’) as requestor name and entered date are variables in the PDF, And then he can update the start date or leave duration and submit his request after updating this record in the database.
    Will you please help me how to do that knowing my PDF contains a digital signature and the data saved in a document variable?
    The connection with oracle created by updating the adobe-ds.xml file in “C:\Adobe\Adobe LiveCycle ES2\jboss\server\lc_turnkey\deploy” and deploying the ojdbc14.jar in “C:\Adobe\Adobe LiveCycle ES2\jboss\server\lc_turnkey\lib”.
    Database is oracle10.2.0.1.0
    Adobe LiveCycle Workbench ES2
    Version: 9.5.0.0.20100908.1.247189
    Many thanks in advanced,
    Mohammed Al-Mosleh

    I solved updating single row issue and retrieving single row from data base issue too ...
    I need an example, that shows us how to retrieve multiple records from a database, we did this, and DISPLAY, we couldn't, the results in a table within a pdf.
    the data stored in XML after using Query Multi Rows in XML Activity in Workbench...
    Can any one Help me how to Disply this XML in a table ??

  • Select and update with lock exclusive

    Hello Everybody
    In our application we have a table autonum     to handle unique keys for all other tables.
    In Autonum we have a column "SUCHBEGRIFF" char(40) unique KEY and a column "WERT" fixed(10,0).
    Suchbegriff has values like Rechnungsnr,Auftragsnr,Bestellnr ...
    Example:
    Befor inserting a record into table rechnungen we do:
    Select wert from autonun where suchbegriff = "Rechnungsnr" with lock exclusive.
    l_rechnrneu = wert + 1 
    update autonum set wert = ?l_rechnrneu where suchbegriff = "Rechnungsnr"
    commit
    (then l_rechnrneu is used for an insert into rechnungen command)
    This technic works for all tables (250) in our application.
    We have about 400 concurrent users working with maxdb 7.6 via odbc 7.6
    No problems since 2 years!
    Now we start some backgroundjobs from an xp-workstation.
    We have scheduled 5 jobs, starting every 5 minutes, same time.(Same user,same odbc-connection)
    Each job inserts records into a table joblogs and therefore needs a unique JOBLOGNR from autonum.
    Now we run into problems 2 or 3 times a day?
    <Sometimes the backgound jobs are running (waiting?) without inserting a record into joblogs (deadlock?)
    And more worse:
    Sometimes the insert into joblogs failes with "duplicate key" ??
    We don't know where to begin? Maxdb Problem ? Workstation problem?
    Any help welcomed
    Best regards
    Albert

    > >Gosh - that's information overloading at it's best...
    > We call this needed information.
    > What does our SAP-System? We have 1 mandt,60 accounting areas and about 200 werks!
    > Of course SAP uses internal unique keys for all tables, but we configured different "number intervals" for each werks.
    With "information overloading" I was referring to the multiple meanings you encode in just one column (your "rechnungs-no").
    SAP tables do not have this.
    As you wrote, there is "MANDT", "BUKRS", "WERKS" ... and the primary key is defined over all relevant columns.
    There is no primary key column where all the different meanings are concatenated together.
    So there aren't any surrogate keys here (a.k.a. AUTOID) used here - (ok except the infamous DDLOG sequence...).
    > >What do you do, when the value of an invoice has to be changed? Update the primary key of the table?
    > Update rechnungen set amount = xyz,...... where rechnungnr = nnn
    > We never change rechnungsnr,if the invoice was wrong we produce a credit for it and then write a new invoice
    So, you could use a sequence here instead as well.
    > > We don't use rollback when fetching logids from autonum.
    > >So what do you do, when connection fails, the database crashes or the client application hits an error?
    > >You use rollback. There is no way to avoid it.
    > >Your application gets a "duplicate key" error - the database performs a rollback of your last action. What does your application do then? Commit?
    > Sorry, i meant that we do not do rollbacks over  2 or 3 inserts or updates in different tables.
    > SQL-Command,On error = messagebox,errorlog,quit
    You don't handle the fetching of the new number in the same transaction as the actual insert of your application data in the same transaction?
    > >What isolation level do you use?
    > We use DATABASE ISOLATION LEVEL 0
    Hmm... did you read the documentation on SQL Locks?
    [Internals Course - SQL Locks|http://maxdb.sap.com/training/internals_7.6/locking_EN_76.pdf] :
    "Isolation level 0 does not offer any protection against access anomalies."
    Basically it might have happened that the same number is read twice.
    Perhaps the application is not always requiring locks when reading data from this table?
    > After connecting to the database via odbc we do
    > =SQLSETPROP(verbindungsnr,"Transactions",2)
    > 2 = Transaction processing is handled manually through SQLCOMMIT( ) and SQLROLLBACK( ). Read/write.
    > =SQLSETPROP(verbindungsnr,"DisconnectRollback",.T.)
    >
    >
    > So normal select commands are fired without a following commit.
    > Insert and update commands are fired with a following commit command.
    > Selects from autonum are fired with "look exclusive"
    Please be more detailed here.
    What is the exact sequence of actions here?
    1. Fetch number from number table and update number table.
    2. COMMIT
    3. Insert new application data with the just fetched number.
    4. COMMIT
    or
    1. Fetch number from number table and update number table.
    2. Insert new application data with the just fetched number.
    3. COMMIT
    And what does your application do with its data when a rollback occurs?
    Is it guaranteed that all variables are reset?
    > Nevertheless you dislike our design, do you think it would be better (quicker,safer...) to use an internal databases procedure to get
    > the next speaking number for a given "suchbegriff" from our autonum table? (no translation of the sql-command every time)
    No, currently we don't know what is causing the problem, so we cannot tell whether such a change would help. In fact, right now it would make things more complicated because we would less understand, what's happening here.
    Concerning your design: it's not about "liking" or "not liking it".
    I just pointed out some problems that result from the design as it is.
    > select   wert into :neuerwert FROM "BWPROGI"."AUTONUM"  WHERE upper(suchbegriff)     = upper(:suchkey) WITH LOCK EXCLUSIVE;
    > update  "BWPROGI"."AUTONUM" set wert = wert + 1 WHERE upper(suchbegriff)     = upper(:suchkey) ;
    > SET neuerwert = neuerwert + 1;
    > end;
    1. The WHERE clause UPPER(suchbegriff) = UPPER(...) is the best way to disable the efficient use of any index structure. Better make sure that your data is in the right format in the table when you enter it and then look it up without the UPPER() conversion. 
    2. I wouldn't perform the increment two times.
    Get the current value into your variable, increment this variable, set the current value in the table to the variable.
    > A char(10) return value would be nice and i don't know wether this would be the quicker way.
    Why should it? You would have to convert it first - that's additional work.
    Anyhow, to move ahead with your duplicate keys problem, you may perform a vtrace with the "stop on error" option.
    As your error is a duplicate key on a primary key constraint you should set "stop on error" to the error code "200".
    The next time your application hits the error, the vtrace automatically stops and we could examine what happened before.
    See [MaxDB database trace|https://wiki.sdn.sap.com/wiki/x/2yg] for details on how to activate the trace.
    When the error occurs next time and you caught it in the vtrace we can take a look at it.
    regards,
    Lars

  • Controversy between SELECT and UPDATE

    I have 2 queries one with SELECT and the other with UPDATE. The WHERE clause in both the queries are exactly same. When I do the SELECT I am getting a row and when I do the UPDATE I am not getting any rows. The following are the queries and descriptions of the tables involved. I tried executing these 2 queries many times and no difference.
    SQL&gt; SELECT * FROM Fraud_30_Day_Summ S1
    2 WHERE s1.Disconnect_Dt = TO_DATE('01-OCT-2008','DD-MON-YYYY')
    3 AND s1.Fraud_Category_Cd = 'CPI'
    4 AND s1.On_Off_Net_Ind = 'Y'
    5 AND s1.Threshold_ind = 'Y'
    6 AND (s1.Icon_Ind IS NULL OR s1.Icon_Ind &lt;&gt; 'N' )
    7 AND (
    8 ( s1.Call_Cnt * .5 &lt;=
    9 ( SELECT SUM(s2.Call_Cnt)
    10 FROM Fraud_CPCS_Call_Detail s2
    11 WHERE s2.Disconnect_Dt = TO_DATE('01-OCT-2008','DD-MON-YYYY')
    12 AND s2.Component_Group_Cd = s1.Component_Group_Cd
    13 AND s2.Component_Grp_Val = s1.Component_Grp_Val
    14 AND s2.Call_type_cd = s1.Call_type_cd
    15 AND s2.On_Off_Net_Ind = 'Y'
    16 AND EXISTS
    17 (
    18 SELECT s3.ROWID
    19 FROM Threshold_Element_Value s3
    20 WHERE s3.Threshold_Element_Val = s2.icon_country_cd
    21 AND s3.Threshold_Id = '405') ) ) );
    DISCONNECT_DT FRAUD_CATEGORY_CD ON_OFF_NET_IND COMPONENT_GRP_VAL COMPONENT_GROUP_CD CALL_CNT CALL_DUR_VAL ICON_IND CELLULAR_IND CUST_SPECIFIC_IND THRESHOLD_IND LAST_USED_IND CALL_TYPE_CD
    10/1/2008 CPI Y 234546575678 CP 3 2474 Y
    Y C
    SQL&gt; Update Fraud_30_Day_Summ s1 SET s1.Icon_Ind = 'N'
    2 WHERE s1.Disconnect_Dt = TO_DATE('01-OCT-2008','DD-MON-YYYY')
    3 AND s1.Fraud_Category_Cd = 'CPI'
    4 AND s1.On_Off_Net_Ind = 'Y'
    5 AND s1.Threshold_ind = 'Y'
    6 AND (s1.Icon_Ind IS NULL OR s1.Icon_Ind &lt;&gt; 'N' )
    7 AND (
    8 ( s1.Call_Cnt * .5 &lt;=
    9 ( SELECT SUM(s2.Call_Cnt)
    10 FROM Fraud_CPCS_Call_Detail s2
    11 WHERE s2.Disconnect_Dt = TO_DATE('01-OCT-2008','DD-MON-YYYY')
    12 AND s2.Component_Group_Cd = s1.Component_Group_Cd
    13 AND s2.Component_Grp_Val = s1.Component_Grp_Val
    14 AND s2.Call_type_cd = s1.Call_type_cd
    15 AND s2.On_Off_Net_Ind = 'Y'
    16 AND EXISTS
    17 (
    18 SELECT s3.ROWID
    19 FROM Threshold_Element_Value s3
    20 WHERE s3.Threshold_Element_Val = s2.icon_country_cd
    21 AND s3.Threshold_Id = '405') ) ) );
    0 rows updated.
    DESC FRAUDCPCS_CALL_DETAIL_
    RECORD_ID{                                                                                         }NUMBER(5,0)
    ORIG_BILL_FILE_ID{                                      }NUMBER(10,0)
    RECORD_SEQ {                                            }NUMBER(10,0)
    BILLING_CYCL_ID {                                        }NUMBER(5,0)
    CUSTOMER_ACCT_ID {                                    } NUMBER(10,0)
    OCCR_NO {                                                    }NUMBER(10,0)
    FRAUD_CATEGORY_CD{    } NOT NULL{        } VARCHAR2(3)
    CALL_TYPE_CD {                } NOT NULL {        } VARCHAR2(1)
    ORIG_TERM_NPA_NXX_CD{                            } VARCHAR2(6)
    COMPONENT_GROUP_CD {    } NOT NULL{    } VARCHAR2(2)
    COMPONENT_GRP_VAL{        } NOT NULL{    } VARCHAR2(26)
    ORIGINATING_DT {        } NOT NULL{    } DATE
    ORIGINATING_TIME_VAL{        } NOT NULL {    } NUMBER(10,0)
    DISCONNECT_DT {                    } NOT NULL{    } DATE
    DISCONNECT_TIME_VAL {        } NOT NULL{    } NUMBER(10,0)
    ORIG_STATE_CD {                                            } VARCHAR2(2)
    TERM_STATE_CD {                                            } VARCHAR2(2)
    CALL_DUR_VAL {                    } NOT NULL {        } FLOAT(12)
    PRCMP_ID{                                                        } NUMBER(5,0)
    ORIG_COUNTRY_CD{                                        } VARCHAR2(3)
    TERM_COUNTRY_CD {                                    } VARCHAR2(3)
    ORIG_CITY_CD {                                                } VARCHAR2(15)
    TERM_CITY_CD {                                                } VARCHAR2(15)
    GSA_ORIG_JURISD_ID{                                      } NUMBER(10,0)
    GSA_TERM_JURISD_ID {                                    } NUMBER(10,0)
    USAGE_CATEGORY_CD{                                    } VARCHAR2(8)
    CALLING_NO {                                                     }VARCHAR2(16)
    CALLED_NO {                                                    } VARCHAR2(20)
    USAGE_TYP{                                                    } VARCHAR2(35)
    INTERNATIONAL_CALL_TYP{                            } VARCHAR2(20)
    VOICE_MAIL_IND {                                            } VARCHAR2(1)
    DIR_ASST_IND {                                                } VARCHAR2(1)
    CALL_FWD_IND {                                                } VARCHAR2(1)
    ROAMING_IND{                                                } VARCHAR2(1)
    CALL_TO_OHSA_IND {                                    }VARCHAR2(1)
    MOBILE_TO_MOBILE_IND {                                }VARCHAR2(1)
    ON_OFF_NET_IND {            } NOT NULL{            } VARCHAR2(1)
    DESTINATION_TXT {                                          } VARCHAR2(14)
    CALL_CNT {                                                      } FLOAT(12)
    ICON_COUNTRY_CD{                                        } VARCHAR2(3)
    DESC FRAUD30_DAY_SUMM_
    DISCONNECT_DT {            } NOT NULL{                    } DATE
    FRAUD_CATEGORY_CD {    } NOT NULL{                } VARCHAR2(3)
    ON_OFF_NET_IND {            } NOT NULL{                } VARCHAR2(1)
    COMPONENT_GRP_VAL {                                    } VARCHAR2(26)
    COMPONENT_GROUP_CD {    } NOT NULL {            } VARCHAR2(2)
    CALL_CNT {                            } NOT NULL {            }FLOAT(12)
    CALL_DUR_VAL{                    } NOT NULL{                } FLOAT(12)
    ICON_IND {                                                              } VARCHAR2(1)
    CELLULAR_IND{                                                        } VARCHAR2(1)
    CUST_SPECIFIC_IND{                                            } VARCHAR2(1)
    THRESHOLD_IND {                                                } VARCHAR2(1)
    LAST_USED_IND {                                                }VARCHAR2(1)
    CALL_TYPE_CD {                    }NOT NULL{            } VARCHAR2(1)
    DESC THRESHOLDELEMENT_VALUE_
    THRESHOLD_ID {                        } NOT NULL {        } NUMBER(5,0)
    THRESHOLD_ELEMENT_VAL {    } NOT NULL {        }VARCHAR2(18)
    Edited by: user10568649 on Nov 8, 2008 11:27 AM
    Edited by: user10568649 on Nov 8, 2008 12:44 PM

    Would it be possible to edit your post to remove all the extra carriage returns? Having two blank lines between every line of code & results is making it somewhat difficult to follow.
    While you are editing the post, it would also be helpful if you could enclose the code & results in the \ tag in order to preserve white space.
    Justin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SELECT query in a sender jdbc comm channel

    Hi experts,
    I would like to access a table in a database and select some rows from there but from a specific date onwards. I mean, i want to retrieve only the rows from, lets say, table.date = 2008-04-05 on.
    So i specified somthing like:
    *SELECT * FROM table WHERE date >= to_date(‘2008-04-05’) and status ='0'*
    UPDATE table SET status='1' WHERE date >= to_date(‘2008-04-05’) and status ='0'
    BUT this is throwing following error message:
    The JDBC driver returned the following error message: 'java.sql.SQLException: ORA-00911: invalid character '. For details, contact your database server vendor.
    Could you please provide some support in order to achieve this?
    Thanks in advance and best regards,
    David

    Hi there,
    I tried again without using the 'to_date' function but still doesnt work.
    I have no access to the database so i asked the DB team to make some testing there. They say the date format in the DB is 'dd-mm-YYYY' but XI receives 'YYYY-mm-dd' via jdbc adapter!!!!
    So, at first i typed 'YYYY-mm-dd' in the query and this was the result:
    Database-level error reported by JDBC driver while executing statement 'SELECT * FROM albaranes,lineas WHERE albaranes.albaran = lineas.albaran and albaranes.fecha_albaran >= ‘2004-06-19’ and albaranes.sap_status ='3''. The JDBC driver returned the following error message: 'java.sql.SQLException: ORA-00911: invalid character '. For details, contact your database server vendor.
    and shortly afterwards i used 'dd-mm-YYYY' and this is what i got:
    Database-level error reported by JDBC driver while executing statement 'SELECT * FROM albaranes,lineas WHERE albaranes.albaran = lineas.albaran and albaranes.fecha_albaran >= '19-06-2004' and albaranes.sap_status ='3''. The JDBC driver returned the following error message: 'java.sql.SQLException: ORA-01843: not a valid month '. For details, contact your database server vendor.
    sap_status field is of string type so this is not the point, i think.
    Could you please advice?
    Best regards,
    David
    Edited by: Domingo Jimenez Navarrete on May 5, 2008 12:18 PM

  • Combine and simplify SELECT and UPDATE sql query

    foreach (BidList t in bidList)
    query = "SELECT operator_id, plot_id, status FROM booking " +
    "WHERE status='open' AND postcode='" + _plot + "' AND operator_id='0'" +
    "ORDER BY datetime ASC;" +
    "UPDATE booking SET operator_id='" + t.OperatorId + "', status='allocated' " +
    "WHERE (plot_id=" + t.PlotId + " AND operator_id='0' AND status='open') LIMIT 1;";
    dbObject.InsertBooking(query);
    I am cleaning up my code, and came across the above SQL query. Before I make use of SQL parameters, I wanted to ask if it is possible to combine them, and if so, how?

    Consider making a single long query using ‘;’ as a separator:
        query = "";
        foreach (BidList t in bidList)
            query += "UPDATE . . . ; ";
        dbObject.InsertBooking(query);
    Use StringBuilder for more improvements.

  • Selecting and Updating in SQL 2005

    I have a situation where I need to select some records from a table. This select query will run again after a certain amount of time. I dont want the second execution of the query to select the records that were selected in the first run. So, what I want is that as soon as I run the first run (or the subsequent runs) and I get the resultset I need to update a flag (which is a column in that table) for all the entries selected in the result set so that next time I run that query, I wont get the same records again.

    hamburger wrote:
    I have a situation where I need to select some records from a table. This select query will run again after a certain amount of time. I dont want the second execution of the query to select the records that were selected in the first run. So, what I want is that as soon as I run the first run (or the subsequent runs) and I get the resultset I need to update a flag (which is a column in that table) for all the entries selected in the result set so that next time I run that query, I wont get the same records again.Presumably this is for a process and not a GUI.
    Write a stored proc that does the following.
    1. Create a transaction.
    2. Make a timestamp
    3. Update the records that have NOT been previously selected using the timestamp from 2.
    4. Select the records using the timestamp.
    5. Commit the transaction.
    6. Return the selected records - including the timestamp as part of each record.
    That last little bit, the timestamp, allows the possibility of logging to a file or back to the database that indicates that a particular block has completed (maybe a status is set.) That way if the process fails there is some way to find the records that were not processed.

  • Execution time difference between SELECT & UPDATE statement in JDBC Sender.

    Hi Experts,
    In my scenario, I have used the JDBC Sender Adapter with the SELECT and UPDATE statement.
    Now the problem is in between the execution of Select and update statement, few more entries are coming in the same DB Table.
    So result of this is updation take place for those entries which are not even picked up by the select statement.
    Can we avoid this execution time difference between the SELECT & UPDATE statemet on JDBC Sender side???
    Thanks & Regards
    Jagesh

    Hi
    Use serializable option in additional parameters, now all new entries would also be updated.

  • Sender JDBC Adapter Select/Update Issue

    Dear All,
    We have configured a Sender JDBC Adapter to Poll data from the DB2 tables. It is working fine and both the select and the update queries written are also getting properly executed and are changing the status of the flag from Y to N once read from database.
    In the communication channel ->
    select * from <table> where flag = 'N'.
    update <table> set flag = 'Y' where flag = 'N'.
    But I have one doubt after executing the select query some new data comes into the table of status flag 'N"., then will this unselected data will also be updated to 'Y' .
    The question is while we do a select and update from XI on the DB table and at the same time there is an insert happening into the table from the other end how will the adpater behave in this case.Will it result in missing of some records during next select/update transaction from XI..
    Your inputs will be appreciated.
    Regards
    Amit

    Amit
    Did you ever get a solution to your question ?
       Sender JDBC Adapter Select/Update Issue  
    Posted: Apr 24, 2008 2:29 PM           Reply 
    Dear All,
    We have configured a Sender JDBC Adapter to Poll data from the DB2 tables. It is working fine and both the select and the update queries written are also getting properly executed and are changing the status of the flag from Y to N once read from database.
    In the communication channel ->
    select * from <table> where flag = 'N'.
    update <table> set flag = 'Y' where flag = 'N'.
    But I have one doubt after executing the select query some new data comes into the table of status flag 'N"., then will this unselected data will also be updated to 'Y' .
    The question is while we do a select and update from XI on the DB table and at the same time there is an insert happening into the table from the other end how will the adpater behave in this case.Will it result in missing of some records during next select/update transaction from XI..
    Your inputs will be appreciated.
    Regards
    Amit

  • Sender JDBC adapter SELECT / UPDATE issue - updates more rows than selected

    Hi,
    We have configured a Sender JDBC Adapter to poll records from an Oracle table based on a flag field and then update the flag for the selected records. When tested in DEV and QA environments (where test data comes in intermittently and not in huge volumes), itu2019s working fine.
    Both SELECT and UPDATE queries written in the Sender JDBC adapter are getting properly executed and are changing the status of the flag for the selected records from Y to N once read from the database.
    select * from <table> where flag = 'N'.
    update <table> set flag = 'Y' where flag = 'N'.
    But in the PROD environment (with records getting updated in the database every second), after XI executes the SELECT query and just before the UPDATE query is executed, new records come into the Oracle table with status flag 'N". So when the UPDATE query runs just after the SELECT query, then these unselected records also get updated to 'Y'. Thus these records never get into the resultset and hence XI and thus remain unprocessed.
    So when XI does a SELECT and UPDATE on the Oracle DB table and concurrently there is an INSERT happening into the table from the other end, the JDBC sender adapter is picking up a certain number of records but updating the status of more records than it picked up.
    So how does XI deal with such a common scenario without dropping records?
    Thanks,
    Vishak

    The condition being checked is the same for both SELECT and UPDATE statements.
    Initially I tried setting transaction isolation levels on the database to repeatable_read and serializable but it was throwing me a java.sql.SQLException error saying that these transaction levels were not valid.
    I asked for these transaction level permissions for the XI user from my DBA but the DB I am accessing provides only a view into other databases and so it's not possible.

  • Sender JDBC adapter -- Update SQL statement NOT work for the last record

    I'm trying to use SAP XI to send records from Oracle database to As/400 using JDBC adapter.  I've defined the communication channel for sender
    (1)  The "Query SQL statement"  = select  a_bgn_dt,  a_end_dt from  PX_PXXD WHERE NOT CU_ACTION_CD='P' 
    (2)   The "Update SQL statement"  = update PX_PXXD set CU_ACTION_CD='P'  WHERE NOT CU_ACTION_CD='P' 
    Supposed that 3 records were retrieved from (1) and successfully updated to AS/400 but only the first 2 records in Oracle database are updated according to (2)
    Any advise.
    Pansy

    Hi Pansy,
    You select and update query is looking like wrong
    kindly check below query,If you are using oracle
    (1) The "Query SQL statement" = select a_bgn_dt, a_end_dt from PX_PXXD WHERE CU_ACTION_CD !='P'
    (2) The "Update SQL statement" = update PX_PXXD set CU_ACTION_CD='P' WHERE  CU_ACTION_CD !='P'
    Thank you
    Sateesh

Maybe you are looking for

  • Documents\*.pdf port missing from printer list

    Hello All, I have Acrobat X installed on my work computer which is Dell running Windows 7. I downloaded the free trial of Acrobat XI to check it out. Don't think I need to shell out the money but it was nice. Anyway, when I uninstalled Acrobat XI I l

  • Oracle XE 12c

    Oracle 12c will be realeased soon (by the end of the year). As well there will be (I assume) a new release of Oracle XE. Did anybody heard, what will be the limitations of Oracle XE 12c?

  • 2008R2 Oracle.exe crashes, no details in alert log/trc files

    On 2008R2 Oracle.exe for 11.2.0.3 crashes, no details in alert log/trc files, System event log does have the following. Is it possible to interpret this errorstack? From Event log: --> SYSTEM Event Viewer entry: Time logged: 12/2/2013 11:09:58 AM eve

  • Itunes & Ipod playback of Live Albums with out Gaps!

    Hi There, this is a message for Apple Personel i guess... Is there a plan for a new release of itunes and ipod software that will get around the gaps between songs? especially noticable on Live albums!! Hope so! Thanks Christian

  • Multiple Trendlines in One Chart

    I need to show two trendlines in a chart - Mean and Linear Regression.  I cannot seem to set them to be different colors.  Short of calculating one of these trendlines on the backend and making it the "series" and having Crystal calculate the other o