Doubt Regarding Updated Rows

Hello,
After using Bulk Collect & FORALL for updating rows in a table
How to find the total number of rows Affected (Updated) ...
please explain by an example..??

Hi Aijaz,
If i'm correct you need to know the number of rows updated after the DML.
This might help.
-- Example Using the RETURNING Clause with a Record
DECLARE
TYPE setRec IS RECORD (key_name settings.settings_key%TYPE,
value_1 settings.settings_date_value%TYPE );
TYPE t_set_info IS TABLE OF setRec;
set_info t_set_info := t_set_info( NULL );
BEGIN
UPDATE settings SET settings_date_value = SYSDATE WHERE settings_key LIKE '%DATE%'
RETURNING settings_key, settings_date_value BULK COLLECT INTO set_info;
DBMS_OUTPUT.PUT_LINE('Total rows ' || set_info.COUNT );
ROLLBACK;
END;
/

Similar Messages

  • Query regarding updating rows in JTable

    Query regarding updating rows in JTable
    Hello,
    I have a JTable with 6 columns and 1000s of rows (which are data read from flat files)
    I can select 1 or more rows and change the values of the
    columns. each time I do this I need to update the values
    in the flat file.
    Currently I assign the updated Jtable values to a vector
    Vector rowVector = (Vector)defaultModel.getDataVector();
    then I iterate over the vector and compare the values with the (old) data
    in the JTable.
                for(int rowCount = 0; rowCount<rowVector.size(); rowCount++){
                    Vector v = (Vector)rowVector.elementAt(rowCount);
                        //smsList is the Vector that contains the old JTable values
                        for(int i=0; i<smsList.size(); i++){
                                //If colums values have been changed; add that
                                //vector value to another vector
                                selectedsmsList.add(smsList.get(i));
                for(int i=0; i<selectedsmsList.size(); i++){
                         //Update the values in the flat file
                }This works fine except that it takes ages to iterate over the updated vecor and un-updated,old vector; is there any way to directly get the list of rows that were updated in the jtable; so that I can directly do an I/O operation to update the jtablke values?

    Just a suggestion.
    You could add a listener and use a vector of booleans to keep track of the rows that have been changed. You could then iterate through this boolean vector and update the changed rows.
    See
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#modelchange
    Don't know whether this will be helpful.
    Regards, Darryl

  • Need help regarding updated rows

    Dear sir,
    need help on this query
    how many rows got updated when i execute an update statement

    If you are executing update statement from sqlplus session.
    Make sure "feedback" is turned on. It'll show numbers of rows updated just after the command;
    SQL> update tt1 set col1 = 1;
    0 rows updated.
    SQL> show feedback
    FEEDBACK ON for 1 or more rows
    SQL> set feedback off
    SQL> update tt1 set col1 = 1;
    SQL>Details about this sqlplus system setting:
    FEED[BACK] {6|n|OFF|ON}
    Display the number of records returned (when rows >= n )
    OFF (or n=0) will turn the display off
    ON will set n=1
    Regards,
    Ullhas

  • Doubt regarding update

    Hi all,
    I've three update statements need to execute on a single table.
    Is there a way I can exeucte the three update statements in a single statement?
        UPDATE xxops_forecast_extract b SET territory_id = (SELECT a.territory_id
             FROM fdev_hier_node_mv a
             WHERE a.shr_node_id = b.shr_node_id
              AND NVL(end_dt,SYSDATE) > SYSDATE) ;
        COMMIT;
        UPDATE xxops_forecast_extract b SET position_id = (SELECT a.row_id
            FROM s_postn a
            WHERE a.name = 'TD-'||UPPER(b.am_id))
            WHERE position_level = 7
            AND b.am_id IS NOT NULL;
        COMMIT;
        UPDATE xxops_forecast_extract b SET position_id = (SELECT a.row_id
            FROM s_postn a
            WHERE UPPER(a.desc_text) = UPPER(TRIM(B.POSITION_NAME)))
            WHERE position_level = 7
            AND b.am_id IS NULL;
    Below are the sample data for the tables.
    xxops_forecast_extract
    shr_node_id am_id position_name  position_id  territory_id
    2231211     Dave     (null)        (null)       (null)
    2231211     Michele  (null)        (null)       (null)
    2231211     (null)   COMM WEST 230 (null)       (null)
    2231211     (null)   COMM ISAM 110 (null)       (null)
    fdev_hier_node_mv
    shr_node_id territory_id
      2231211      5694
    s_postn
    row_id    name       desc_text
    12122   TD-Dave     (null)
    12123   TD-Michele  (null)
    89381   (null)          COMM WEST 230
    89382   (null)          COMM ISAM 110
    Resulting table after update
    xxops_forecast_extract
    shr_node_id am_id position_name  position_id  territory_id
    2231211     Dave     (null)        12122       5694
    2231211     Michele  (null)        12123       5694
    2231211     (null)   COMM WEST 230 89381       5694
    2231211     (null)   COMM ISAM 110 89382       5694Thanks all.

    Hi,
    You can combine the statements by combining the sub-queries.
    Any logic that does not apply to all the original UPDATEs has to be taken out of the WHERE-clause and put into a CASE statement.
    Any CASE statements should "update" a column to itself if none of the conditions apply.
    For example, your last two UPDATE statements, which both have sub-queries on s_postn, can be combined like this:
    UPDATE     xxops_forecast_extract     b
    SET     position_id =
         SELECT     CASE
                   WHEN     (     b.am_id          IS NOT NULL
                        AND     UPPER (a.name)     = 'TD-' || UPPER (b.am_id)
                   OR     (     b.am_id          IS NULL
                        AND     UPPER (a.desc_text)     = UPPER (TRIM (b.position_name))
                   THEN     a.row_id
                   ELSE     b.position_id
              END
         FROM     s_postn     a
            WHERE     UPPER (a.name)          = 'TD-' || UPPER (b.am_id)
         OR     UPPER (a.desc_text)     = UPPER (TRIM (b.position_name))
    ;There seem to be some errors in the UPDATE statemnts you posted. For example, the last two refer to a column called position_level which doesn't exist in either table.
    The statement above produces the results you want with the data you posted.
    As you can see, the coding is much harder to understand, debug and maintain.
    Whether the gain in performance (if any) justifies the addional complexity is debatable in this case.
    I feel sure that combining all three queries would not be worthwhile.
    Consider using MERGE: it's sometimes easier to use, even if, as in this case, you're never INSERTing.

  • There was an error while updating row count for "SH".."SH".CHANNELS

    Hi All,
    Am new to OBIEE.Pls help in this regard.
    Am building the physical layer as per Repository guide.When am importing the data in to this,am getting the below error.
    *"There was an error while updating row count for "SH".."SH".CHANNELS" :"*
    channles is the table name and having 5 rows.
    but am able to see the data in the sql prompt. like SELECT * FROM SH.CHANNELS then 5 rows data would be displaying..
    pls help in this regard and where is the excat problem?
    Thanks,

    what is the error?
    Make sure that your connection pool settings are okay..
    Make sure that, you are using correct driver in case of if you are using ODBC dsn..
    Also make sure that, your oracle server is running... TNS and Oracle server services

  • Query regarding updation thru a Procedure

    Hi,I have a query regarding updation.
    1.I invoke a procedure in Oracle called submit thru my Java application.
    The submit procedure saves the XML data in the database
    and displays this data in a Front End GUI.
    2. Now,I make a change in my Java application by adding new elements to the same row.This row now contains additional XML elements.
    I would like to display the new row with the new elements in the GUI.
    What is a better option for doing the above?
    1.Delete the row being shown,save the new row with the changes in the database,and re display it?
    2.Or,Update the row dynamically and refresh?
    Any suggestions
    Thanks,

    Hi,I have a query regarding updation.
    1.I invoke a procedure in Oracle called submit thru
    my Java application.
    The submit procedure saves the XML data in the
    database
    and displays this data in a Front End GUI.
    2. Now,I make a change in my Java application by
    adding new elements to the same row.This row now
    contains additional XML elements.
    I would like to display the new row with the new
    elements in the GUI.
    What is a better option for doing the above?
    1.Delete the row being shown,save the new row with
    the changes in the database,and re display it?
    2.Or,Update the row dynamically and refresh?
    Any suggestions
    Thanks,If you delete (it seems to me yours this process is regular and frequent) and re insert the new updated one record then High water mark will cause to scan yours table which may cause to degrade the performance.AFAIK you should go with update.But hold down dont implement it as i suggested lets see what are others solution here which may be more precious then mine.
    Khurram

  • How can i update rows  in a table based on a match from a select query

    Hello
    How can i update rows in a table based on a match from a select query fron two other tables with a update using sqlplus ?
    Thanks Glenn
    table1
    attribute1 varchar2 (10)
    attribute2 varchar2 (10)
    processed varchar2 (10)
    table2
    attribute1 varchar2 (10)
    table3
    attribute2 varchar2 (10)
    An example:
    set table1.processed = "Y"
    where (table1.attribute1 = table2.attribute1)
    and (table1.attribute2 = table3.attribute2)

    Hi,
    Etbin wrote:
    Hi, Frank
    taking nulls into account, what if some attributes are null ;) then the query should look like
    NOT TESTED !
    update table1 t1
    set processed = 'Y'
    where exists(select null
    from table2
    where lnnvl(attribute1 != t1.attribute1)
    and exists(select null
    from table3
    where lnnvl(attribute2 != t1.attribute2)
    and processed != 'Y'Regards
    EtbinYes, you could do that. OP specifically requested something else:
    wgdoig wrote:
    set table1.processed = "Y"
    where (table1.attribute1 = table2.attribute1)
    and (table1.attribute2 = table3.attribute2)This WHERE clause won't be TRUE if any of the 4 attribute columns are NULL. It's debatable about what should be done when those columns are NULL.
    But there is no argument about what needs to be done when processed is NULL.
    OP didn't specifically say that the UPDATEshould or shouldn't be done on rows where processed was already 'Y'. You (quite rightly) introduced a condition that would prevent redo from being generated and triggers from firing unnecessarily; I'm just saying that we have to be careful that the same condition doesn't keep the row from being UPDATEd when it is necessary.

  • Have some doubt regarding the  weblog (Lookup's in XI made simpler)

    Hi All,
    I have created the same scenario as mentioned in Siva's weblog (Lookup's in XI made simpler).
    I having some doubts regarding the scenario, it will be great if you help me to resolve the same.
    I am having a file-file scenario where I need to do lookup in database(MS-Access)  through mapping.
    The standard file-file scenario is in place and in addition I have created a receiver jdbc channel . I  have also created the receiver agreement for the same in the cofiguration.
    While creating the receiver agreement you have to specify the interface name which includes the message type…I have specified the normal format which we specify while configuring the jdbc receiver adapter.
    In the message mapping I have created a advance user defined function as mentioned in your weblog which calls my receiver jdbc channel.
    I have also specified the select query to be executed in the mapping program.
    While testing I am getting the following error
    Cannot produce target element /ns0:Role_MT/URole. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd
    <b>Can you please suggest me what all I need to do in addition to the file-file scenario for this lookup scenario to work.</b>
    Thanks and Regards
    Rahul

    Hi,
    Following is my user defined function
    //write your code here
    String Query = "";
    Channel channel = null;
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet = null;
    Query = "Select URole from  Lookup where UName = '  " + UName[0] + "  ' and UPassword = '  " + Pwd[0] +" '  ";
    try{
    channel = LookupService.getChannel("DB_service","JDBC_channel_receiver");
    accessor = LookupService.getDataBaseAccessor(channel);
    resultSet  = accessor.execute(Query);
    for(Iterator rows = resultSet.getRows();rows.hasNext();){
    Map rowMap = (Map)rows.next();
    result.addValue((String)rowMap.get("URole"));
    catch(Exception ex){
    result.addValue(ex.getMessage());
    finally{
    try{
    if (accessor!= null) accessor.close();
    catch(Exception ex){
    result.addValue(ex.getMessage());
    Thanks and Regards
    Rahul

  • Doubt regarding SQL execution

    Hi Friends,
    Am using Oracle 10g DB - 10.2.0.3.0
    I have some basic doubts regarding sql query execution by Oracle.
    Say, Am executing a query from a toad/sqlplus session for the first time, it takes 10 secs then 1 sec and so on.
    Same thing happens for every 15 minutes.(Any specific reason for this ??).
    It takes more time when it executes first because of parsing and all those stuff but from then on it picks from the
    shared pool right??.. How long will it be there in Shared Pool does Oracle maintain any specific time period to clear that query from shared pool memory. How does Oracle handle this.
    Another thing is, say, I have a report query, I run this query monthly. What will be the execution time when I run this query each and every month. Will Oracle parse this query everytime I run. How do I improve the performance in this situation (May sound odd :)).
    Regards,
    Marlon

    Say, Am executing a query from a toad/sqlplus session for the first time, it takes 10 secs then 1 sec and so on.
    Same thing happens for every 15 minutes.(Any specific reason for this ??).
    It takes more time when it executes first because of parsing and all those stuff but from then on it picks from the
    shared pool right??.. How long will it be there in Shared Pool does Oracle maintain any specific time period to clear that query from shared pool memory. How does Oracle handle this. Share Pool caches the SQL statement. So when you execute the same SQL for the second time it goes for a soft parse. But this is not the only reason for the query to execute faster the second time. The time difference between a soft parse and hard parse is very minimal. So it really does not matter unless you are executing the same query several number of times.
    The thing that really matters is the Data Buffer Cache. That is the rows that are selected by your query are cached into the Data buffer that is available in the SGA. So for the next time when you run the same query the IO is reduced as the data is available in the memory and you don't have to go to your disk to get the data.
    But the data in Data Buffer is not persistent, meaning it follows the FIFO rule. That is first in first out. When the Data Buffer is full the content of the buffer is removed in the FIFO order.
    Another thing is, say, I have a report query, I run this query monthly. What will be the execution time when I run this query each and every month. Will Oracle parse this query every time I run. How do I improve the performance in this situation (May sound odd :)). Like the Data Buffer the Shared Pool is also maintained in the FIFO order. So if the query is still in the Shared Pool the query will be soft parsed else it will be hard parsed. But its very rare that you will have a query in your Shared Pool for a month.

  • ExecuteBatch(): number of successfully updated rows

    Hello everybody:
    Here is a simple but often a repeated question in java forums:
    Requirement:
    1.To read a flat file that has many rows of data.
    2.Parse the data and update the database accordingly.
    3.Find the number of successfully updated rows.
    Approach:
    After reading the file and parsing its data,
    - use PreparedStatement
    - use executeBatch()
    I found this as unadvisable to use executeBatch() as its implementation is
    inherently driver specific. The executeBatch() returns an array of update counts.
    Now,can any one tell me, what is the best way to trace the number of successfully
    (and unsuccessfully) updated rows by using this count?
    Is there any other way to achieve the same by not using executeBatch()?
    Can any one share a snippet of code to achieve this specific functionality?
    [Need is to log the number of unsuccessful attempts along with their
    corresponding rows of data].
    Thanks & regards,
    Venkat Kosigi

    executeBatch submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. The int elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the method executeBatch may be one of the following:
    -- A number greater than or equal to zero indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution
    -- A value of -2 indicates that the command was processed successfully but that the number of rows affected is unknown
    If one of the commands in a batch update fails to execute properly, this method throws a BatchUpdateException, and a JDBC driver may or may not continue to process the remaining commands in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process commands or never continuing to process commands.
    If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts will contain as many elements as there are commands in the batch, and at least one of the elements will be the following:
    -- A value of -3 indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails.
    return values have been modified in the Java 2 SDK, Standard Edition, version 1.3 to accommodate the option of continuing to proccess commands in a batch update after a BatchUpdateException obejct has been thrown.
    Throws BatchUpdateException (a subclass of SQLException) if one of the commands sent to the database fails to execute properly or attempts to return a result set. The BatchUpdateException getUpdateCounts() method allows you to known the element who caused the fail identified by a -3 value.
    -- So, if you have a succesfully result, look for at the executeBatch returned array ( #values >= 0 ) + ( #values == -2 ) = successes
    and if you have not a succesfully result, catching the BatchUpdateException take the array returned by the getUpdateCounts() method, and look for the position in which array values are -3. You could take the data at this position on batch and log it.
    -- Other way to insert a bulk copy on database is to use a bcp command ( it�s not java, bcp is an independent command ) that allows you to do bulk inserts from file, indicate an error file, bcp will give to you as result a file with those lines not where inserted.
    I hope have help you.;)

  • Plz clear the doubt regarding  Currrent indicator value in   cluster RT

    Hi Gurus,
    Current Indicator in RT table have the values as A and P. So as payroll is run in the month Feb and retro run  for Jan also. There are two result in RT with the Current Indicator A(Feb) and P(Jan retro)  OR  both have the same indicator as A and P for the previous Payroll RUN...
    Please  clear this ..
    Regards
    LAKHAN

    HI Srinivasarao,
    Thanks for the reply.
    I am still a little bit confused ..AS there in T-code  PC_PAYRESULT (for cluster data display)  :
    Payroll is run for  Feb.2008
    SEQNR     FPPER     FPBEG            FPEND             INPER       IPEND                  SRTZA
    61       200710     20080101     20080131     200710     20080131          P
    62       200710     20080101     20080131     200711     20080229          A
    63       200711     20080201     20080229     200711     20080229          A
    The Last Two row show the  payroll results for the  Feb.2008 wih the  A indicator.
    Is this corrrect 
    OR  the below  rows are correct(AS i have understand from your reply)
    62       200710     20080101     20080131     200711     20080229          P
    63       200711     20080201     20080229     200711     20080229          A
    Please clear my  doubt
    Regards
    lakhan

  • Polling Strategy to get back inserted/updated rows from BPEL

    Hi,
    Can anybody have code to get back the newly inserted/updated rows from database table, using DbAdapter Polling Strategy from BPEL Process.

    Hi user559009,
    Could you please elaborate a bit more about what it is you need.
    If you create a Partner link that polls a table and then create a receive activity that uses the partner link the variable in the receive activity will contain the data from the table.
    Regards Pete

  • No data on PDA - Cannot update row in status - 14

    Hi,
    after login and after sync i get this exception on log console: Thread: Thread-5 Error: Error in deployment --&gt; java.lang.IllegalStateException: Cannot update row in status - 14
    at com.sap.tc.mobile.cfs.sync.InternalSyncState.update(InternalSyncState.java:27)
    and i don't see any data on my data object...
    have you any idea?
    Best Regards,
    Alessandro Chessa.

    Hi Alessandro,
    Which PDA application are you using? Is it AWT/OCA/JSP?
    Are you deploying the application locally or through server?
    It will help if you let us know what steps you followed to get this error.
    Best Regards,
    Amit

  • Doubt regarding SHDB transaction

    Hi All,   
                I have a doubt regarding the Process Tab in the application tool bar of SHDB transaction. What is the use of the following check boxes?
    1)       Default Size
    2)       Cont.after commit
    3)      not a batch input session
    4)      END: Not a Batch Input session
    5)      Simulate Background mode

    Hi,
    Basically these are the properties for CALL TRANSACTION using. You need not worry about these unless you really need those.
    1) Default Size: it will set the Default screen size for CALL TRANSACTION USING...
    2) Cont.after commit : it will set indicator that CALL TRANSACTION USING... is not completed by COMMIT. after commit also the process will continue
    3) not a batch input session: sets indicator that present session is not batch input
    4) END: Not a Batch Input session
    5) Simulate Background mode : session will be run in foreground. but similar to back grpund
    you can see the documentation by placing the cursor on these and click f1.

  • I was looking at the "Find my iPhone" app and I have a doubt regarding how it works for the macbook. In order to detect the location, the macbook should remain signed into iCloud. What if the thief logs out of iCloud. Would we able to locate the macbook?

    I was looking at the "Find my iPhone" app and I have a doubt regarding how it works for the macbook. In order to detect the location, the macbook should remain signed into iCloud. What if the person who has stolen my macbook logs out of iCloud.
    It should work fine for iPhone/iPad because we can enable "Restrictions" to prevent the user from signing out of iCloud. Do we have simialr settings for the macbook?
    Thanks,

    If it's not on the device list, it indicates that someone has gone to Find My iPhone on icloud.com and manually deleted it from the device list (as explained here: http://help.apple.com/icloud/#mmfc0eeddd), and it has not gone back online since (which would cause it to reappear on the device list; Find My iPhone has been turned of in settings on the device; the iClolud account has been deleted from the device; or the entire devices has been erased and restored.
    Unfortunately, there's no other way to track the phone other than through Find My iPhone.  You could call your carrier and see if they would blackliste it so at least the theif couldn't use it.

Maybe you are looking for

  • How come the same apps that are available for my iPhone and my iPad are not the same as the apps in the app store on my mac

    I want some of the same apps available on my iphone and ipad2 to be available on my macbook pro app store and to be able to link them through icloud. Is this not possible? If not, why not?

  • Adapter Engine In Communication Channel Creation

    Hi All, Im trying the first scenario in new PI 7.0 server. When i tried to use a file adapter, after selecting the transport and msg protocol.. In the adapter engine..I dont see anything in the drop down.. can u pls help me out on this..has ne one fa

  • Movement Type 351 against scheduling agreement for future dates

    Dear Gurus, For stock transfer orders(Inter Plant Transfers), if the schedules in receiving plants are available only in future(say after 15 days), the sending plant is able to make 351 against such scheduling agreements today itself. Is there any wa

  • Native call in JCVM

    Hi All, I read the specs of JCVM and i knew that the native keyword is not supported. Hence i am confusing that how the jcvm knows that whether it needs to access to native methods defined in JCRE? I don't see any flag indicating if a method is nativ

  • JPA's EntityManagerFactory jndi lookup problem

    Hi, I need to do jndi lookup of EntityManagerFactory from DAO layer. I don't want to inject entitymanagerfactory in a session bean. I am using weblogic 10.0 . I could do a jndi lookup for jboss and oracle servers but not for weblogic I have tried bel