Problem with batch execution

I am using batch execution for inserting records in a table.
My code is as follows
// set Batch size to 1
for (i = 0; i < 23; i++) {
// set first & second columns to some value
ps.setInt(1,j);
ps.setString(2,"cat");
// execute batch
rowsInserted = ps.executeUpdate();
// send last batch (if any)
rowsInserted = ((OraclePreparedStatement)ps).sendBatch ();
// set first & second columns to some value
ps.setInt(1,100);
ps.setString(2,"dog");
// execute batch
rowsInserted = ps.executeUpdate();
Here total 25 rows were inserted.
23 rows from the loop.
remaining two rows has the same value (100,"dog")
I was expecting 24 rows in the table
23 rows from loop
no row from sendbatch since no record accumulated. (batch is of size 1)
one record from last insert statement. (100,"dog")
does anyone know why this happened?
null

More code to figure this out may help.
Also, the term "Batch execution" doesn't apply here... you're simply adding records, near as I can tell.

Similar Messages

  • Apex 4 , problem with collection executions

    Hi ,
    I am having the following problem with the execution of one collection :
    Reference thread : Re: APEX 4 , executing a remote procedure and populating data using collection
    DBNAME ---> list item which I build from the DB links which I built ( as dynamic query in the shared components from a local table which holds entries of dblink names )
    USERLIST --> list item of users which should display dynamicaly the users of that db link I choose in DBNAME ( based on a collection )
    buttons CANCEL and SUBMIT
    4- Initial COLLECTION page process which is calculated before Header :
    DECLARE
    q varchar2(4000);
    BEGIN
    IF APEX_COLLECTION.COLLECTION_EXISTS(P_COLLECTION_NAME => 'QRY1') THEN
    APEX_COLLECTION.DELETE_COLLECTION(P_COLLECTION_NAME => 'QRY1');
    END IF;
    q := 'SELECT username , username FROM sys.dba_users@'||:P23_DBNAME ;
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
    P_COLLECTION_NAME => 'QRY1',
    P_QUERY => Q);
    END;
    For USERLIST list item I am using the following in LIST OF VALUES DEFINITION :
    SELECT C001, C002 FROM APEX_COLLECTIONS WHERE COLLECTION_NAME='QRY1'
    5 - to submit the values from the screen to the remote database procedure I am using the following submit process ON SUBMIT AFTER CALCULATIONS:
    DECLARE
    v_statement varchar2(255);
    BEGIN
    v_statement := 'begin
    Lock_User@&P24_DBNAME.(''&P24_USERLIST.'');
    insert into log values (1,''user locked'') ;
    commit ;
    end;';
    EXECUTE IMMEDIATE v_statement;
    END;
    The problem :
    The form runs sucessfully , where I the USERLIST changes dynamicaly when I change the DBNAME values , but as soon as I logout and login with another user1 , the collection does not execute and i get "ORA-01729: database link name expected".
    I login with user1 in edit mode and recreate the collection , run again , the collection executes successfuly .
    If I create a new user2 ( using the sample application pages ) and login with the new user2 , i have the same problem , thus I ho login with user2 in edit mode and try to run the collection .
    How can I control the collection to execute regardless of the application user logged in ??
    thanks in advance
    yousef

    Hi ,
    I am having the following problem with the execution of one collection :
    Reference thread : Re: APEX 4 , executing a remote procedure and populating data using collection
    DBNAME ---> list item which I build from the DB links which I built ( as dynamic query in the shared components from a local table which holds entries of dblink names )
    USERLIST --> list item of users which should display dynamicaly the users of that db link I choose in DBNAME ( based on a collection )
    buttons CANCEL and SUBMIT
    4- Initial COLLECTION page process which is calculated before Header :
    DECLARE
    q varchar2(4000);
    BEGIN
    IF APEX_COLLECTION.COLLECTION_EXISTS(P_COLLECTION_NAME => 'QRY1') THEN
    APEX_COLLECTION.DELETE_COLLECTION(P_COLLECTION_NAME => 'QRY1');
    END IF;
    q := 'SELECT username , username FROM sys.dba_users@'||:P23_DBNAME ;
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
    P_COLLECTION_NAME => 'QRY1',
    P_QUERY => Q);
    END;
    For USERLIST list item I am using the following in LIST OF VALUES DEFINITION :
    SELECT C001, C002 FROM APEX_COLLECTIONS WHERE COLLECTION_NAME='QRY1'
    5 - to submit the values from the screen to the remote database procedure I am using the following submit process ON SUBMIT AFTER CALCULATIONS:
    DECLARE
    v_statement varchar2(255);
    BEGIN
    v_statement := 'begin
    Lock_User@&P24_DBNAME.(''&P24_USERLIST.'');
    insert into log values (1,''user locked'') ;
    commit ;
    end;';
    EXECUTE IMMEDIATE v_statement;
    END;
    The problem :
    The form runs sucessfully , where I the USERLIST changes dynamicaly when I change the DBNAME values , but as soon as I logout and login with another user1 , the collection does not execute and i get "ORA-01729: database link name expected".
    I login with user1 in edit mode and recreate the collection , run again , the collection executes successfuly .
    If I create a new user2 ( using the sample application pages ) and login with the new user2 , i have the same problem , thus I ho login with user2 in edit mode and try to run the collection .
    How can I control the collection to execute regardless of the application user logged in ??
    thanks in advance
    yousef

  • Problem with slow execution on a cFP-2120

    I have an application that runs on a cFP-2120, using web interface for the user to interact with the program.
    I have noticed that in order to get the web interface to get updated I have to use property nodes and write to the value property, see this article:
    http://digital.ni.com/public.nsf/allkb/FC5024A5DD6344C886256C8C0054689B?OpenDocument
    However, this seems to give me a serious performance hit, as described here:
    http://forums.ni.com/ni/board/message?board.id=170&thread.id=153531&view=by_date_ascending&page=1
    I have tested with this code, and with my LV 8.2 a loop that uses 277ms to complete when writing directly to a indicator will use 203159ms when using a property node.
    So, I need to update several front panel objects using the value property, but can't afford the cpu time. Does anyone have a suggestion how to do this as efficiently as possible? The problem is apparantly that using the value property requires the front panel to be loaded - can I for instance avoid doing this once for each variable?

    I've changed the vi now so it only writes to value property when a value has changed. This has cut execution time in half, from 500ms to 250ms. I still think this is quite a lot...
    To give you an indication of "size", the executeable is 1210kb with 2 dll's of 872 and 168kb.
    I've not tried deploying a smaller (cut down?) version - what exactly do you mean?
    With regards to writing to value instead of locals or directly - I've had problems with the values not updating - but not always - and the first link does suggest a bugfix. I'd like to know why wiring to value property is sometimes needed and sometimes not.

  • Problem with batch in outbound delivery

    Hi gurues...I´m newby in SD and I have the followin problem.
    I confirm an outbound delivery that need a batch, without the batch.
    Obviously I can´t post goods receipt, but when i do the shipment,
    it creates the bill but it don´t post goods receipt because it says that i need a batch in the position. How can i do to avoid that the shipment creates the billing without the batch??????..... 

    Jorge,
    Here I am giving you more idea batch determination so that it will be more easy for you to correct the isue as you are new.
    On batch determination, the whole process, how it is determined automatically in the order.
    1)     Normally we use batch determination at delivery level, because at the time of order material may or may not be created. For this material should be configured with batch and batch determination should be checked in sales views of material.
    2)     A2) Batch Determination during order Creation.
    For this you need to maintain Classes d for you Material. Depending on the Manufacturing process you can define the characteristics for your material.
    Ex: Purity for Medicines, Resistance for Electric Items.
    You need to create a class (You might have to create a new class type) which incorporates the characteristic.
    First Create the Characteristic Using Ct04 and then using Cl02 create the Class including this characteristic.
    Then in your material master Classification View Enter this class.
    Then Create a Batch for the particular plant and Stor Loc using MSC1N.Give the value of the characteristics in this batch.
    Then go to SPRO ->Logistics General ->Batch Management and maintain the Condition Technique (Procedure, Strategy Types and assignment to sales docs etc).
    Then Create the Batch Determination Record using VCH1.

  • Problem with different execution paths in hierarchical query

    Hello,
    I have problems with the following query:
    SELECT DISTINCT P.ID FROM PRODUCTELEMENTIMPL P WHERE ( ( LABEL = 'SomeLabel' AND PRODUCTELEMENTTYPE = 'SomeText' AND ( STATE = 'created' OR STATE = 'stored' OR STATE = 'archived' OR STATE = 'archivedRestored' ) ) ) START WITH P.ID = 42 CONNECT BY PRIOR P.ID = P.PARENT
    We have two databases (an Oracle 10g XE and Oracle10g Enterprise). In the XE Database the query is executed very fast, but in the main installation it takes minutes. If I "explain" the query I get two different execution paths:
    The fast:
    ID      PARENT_ID      LEVEL      SQL      Kosten      Anzahl Zeilen
    0      -      1      SELECT STATEMENT      20      49
    1      0      2      HASH UNIQUE      20      49
    2      1      3      FILTER      -      -
    3      2      4      CONNECT BY WITH FILTERING      -      -
    4      3      5      TABLE ACCESS BY INDEX ROWID PRODUCTELEMENTIMPL (TABLE)      -      -
    5      4      6      INDEX UNIQUE SCAN SYS_C0072201 (INDEX (UNIQUE))      2      1
    6      3      5      NESTED LOOPS      -      -
    7      6      6      BUFFER SORT      -      -
    8      7      7      CONNECT BY PUMP      -      -
    9      6      6      TABLE ACCESS BY INDEX ROWID PRODUCTELEMENTIMPL (TABLE)      19      49
    10      9      7      INDEX RANGE SCAN PRODUCTELEMENTIMPL_IDX1 (INDEX)      3      49
    11      3      5      TABLE ACCESS FULL PRODUCTELEMENTIMPL (TABLE)      19      49
    Slow:
    ID PARENT_ID LEVEL SQL Kosten Anzahl Zeilen
    0 1 SELECT STATEMENT 1 1
    1 0 2 HASH UNIQUE 1 1
    2 1 3 FILTER
    3 2 4 CONNECT BY WITHOUT FILTERING
    4 3 5 TABLE ACCESS BY INDEX ROW 3 1
    ID PRODUCTELEMENTIMPL (TABLE)
    5 4 6 INDEX UNIQUE SCAN SYS_C0 2 1
    020528 (INDEX (UNIQUE))
    6 3 5 TABLE ACCESS FULL PRODUCT 6628 1100613
    ELEMENTIMPL (TABLE)
    Any ideas how to avoid this full table scan?
    bye
    Roland Spatzenegger

    Hello,
    thank you for your replies. The indices and table schemas are the "same", but only the content for the tables was mirrored.
    We made some tests with dropping and/or analyzing the tables, but it didn't change anything.
    The main problem is that the query takes 33s in the productive environment for searching in a couple of rows. At the moment it's faster to make
    SELECT DISTINCT P.ID, P.STATE FROM PRODUCTELEMENTIMPL P WHERE ( ( LABEL = 'SomeLabel' AND PRODUCTELEMENTTYPE = 'SomeText' ) ) START WITH P.ID = 42 CONNECT BY PRIOR P.ID = P.PARENT
    and to test in the application if the state-values match ;-)
    If I add the hint /*+ no_filtering */ in the test environment, I get the same "slow" execution path as in the production environment. So the question is, what prevents the filtering in "connect by"?
    (I think in the fast version it filters only the results of the hierarchical query, in the slow version it first filters the whole table and joins/merge it with the hierachical result).
    bye
    Roland Spatzenegger

  • Bpc : problem with batch logic setting

    Hi,
      I am using bpc 7.0 MS version 7.0.112.
      i am trying to run a customized DM package. in test6.lgf, i have the following codes (thanks to Tim):
    *SELECT(%UsersChoiceTimeID%,[TimeID],[TIME],"[ID]='%TIME_SET%'")
    *SELECT(%UsersChoiceYEAR%,[Year],[TIME],"[ID]='%TIME_SET%'")
    *XDIM_MEMBERSET TIME = %UsersChoiceYEAR%.JAN,%UsersChoiceYEAR%.DEC
    *xdim_memberset account=extsales
    *CALC_EACH_PERIOD
    *When TIME.TIMEID
    *IS < %UsersChoiceTimeID%
      *rec(factor=2,account="icsales")
    *IS %UsersChoiceTimeID%
      *rec(factor=3,account="icsales")
    *IS > %UsersChoiceTimeID%
      *rec(factor=4,account="icsales")
    *ENDWHEN
      when i tried to VALIDATE and SAVE the above lgf, i got the error message "invalid object name 'mbr'. in select [TIMEID] from mbr[TIME] where [ID]='%TIME_SET%'
      hence i just SAVED this test6.lgf.
      then i created a customized DM package using the normal method, and have it pointing at test6.lgf, when i tried to run this package, i got an error "invalid object name 'mbr'. in select [TIMEID] from mbr[TIME] where [ID]='june.2005'
      do note that i entered category:actual, entity:salesfrance, time:2005.june when prompted.
      in my input schedule, i have previously entered values for category:actual, entity:salesfrance, time:2005.jan - 2005.dec
      any idea how i can rectify this? i am trying to simulate a situation where *select can only be validated and run using a DM package.
      thanks in advance

    Thanks for the response, JettR.
    You have correctly described the problem I'm having.  Let me clarify a couple points.  As it turns out, it doesn't seem to matter whether I enter and exit the synchronized section using the batch sync steps or if I set the properties of the individual steps to run in "one-thread-only" mode.  It also doesn't seem to matter whether I've assigned names to the synchronized sections or not.  One other thing - it doesn't matter if an error occurred - the problem is an execution terminating...  I typically terminate an execution (continue to clean-up) if an error occurs, but this can also be reproduced by manually terminating the execution.  Also, the problem is more than just the terminated execution running the synchronized section before the other executions are ready - the section is actually executed twice.  (Once by the terminated execution, and once by the next execution in line.)
    In short, I seems like one potential work-around would be to add some additional code to jump past the cleanup sync section if 1) the execution is terminating and 2) it isn't the only execution running.  But it seems like there should be a better way than that.
    I've attached a simple sequence that can be used to reproduce the problem.  If you run it without terminating any threads, everything will behave as expected.  But if you terminate an execution while in the delay in the Main step group, you should see the one-thread-only synchronized step in the cleanup group (a TestStand dialog) get displayed twice.
    Let me know if you have any questions.  Thanks.
    Attachments:
    BatchSyncIssue.seq ‏32 KB

  • Problem with batch management indicator

    Hi Gurus,
    I have an issue with batch management.
    There is one material which was not batch managed. The requirement was to make it batch managed. There were no open purchase orders and the only thing pending was the stock in the present and previous periods. The stock quantity in the previous period  and the present period matched(470 Kg). I opened the previous posting period, used movement type 551 and scrapped the stock. There was zero stock for the current period and the present period.
    I changed the batch management indicator successfully. Now the issue is whil i am trying to cancel the material document
    1. Now that the material is batch managed, whie trying to cancel the material document using MIGO, the system prompts  for a batch to be entered. But the batch field is greyed out and i am not able to enter a batch
    2.  I have tried to cancel the material document using MBST and MIGO. The sytem prompts for a batch to be entered but not allowing me to do so as the batch field is greyed out.
    Any pointers will be appreciated.
    Many Thanks,
    Sajin

    Hi Sajin,
    What is a reason to cancel a material document? When was that material document created? Before or after flagging the indicator in the material master?
    Ilya.

  • Business Rule - Problem with Validation Execution

    I'm running into an issue where conditional Validation Execution is not working as expected. The background is that i have an Entity Object containing a few string attributes on which i must apply Regular Expression business rules to make sure only characters in a certain range is set. I am using a Not Matches regex on the following:
    .*[^\u0020-\uD7FF].*1 attribute is required, 2 are optional. The problem I am experiencing is with the 2 optional attributes.
    Since these are optional, I intended to use the Validation Execution tab so that the Rule is executed only when the attribute is not null. For example, here is what i tried for an attribute named Comments:
    Comments != nullNo validation occurred when I entered an invalid value, such as a string containing line breaks, in a corresponding ADF Faces page. For the heck of it, i experimented by setting the validation execution to the opposite of what i should be - in other words, trigger validation if the attribute is null, such as:
    Comments == nullWith this, the validation occurred as expected.
    Is this a bug, or am I misunderstanding something? I'm not particularly good with RegEx - is it possible this is due to some nuance of the expression?
    Version: JDeveloper 11.1.1.6.
    Thanks-
    -george

    i'm not sure if this is the correct answer or a workaround to the issue i had asked about. Given that caveat, if anyone else ever runs across this thread, what i found worked was to not use the attribute name in the Validation Execution tab's expression, but instead to just newValue as in the following:
    newValue != null

  • Dear all i have a problem with batch selection

    Hello ,
    i have this problem , i  can't assign automatically batches to some promotional material items, we have generic batches accord to the price of this items. when i deliver the order i have to put mannually the batch.
    Some of you can help me?
    i tried to classificate the batch with transsaction MSC2N but this changes are not saved and when i start another order must to put batch manually again
    Thanks

    For Batch determination in Delivery:
    -Please check if the Material Masters for these materials have been extended to Classification Views with class 023.
    -Check VCH1   if the search strategy records are maintained .
    There is also a detailed document here :
    Automatic Batch Determination Based on Shelf Life

  • Problem with Batch Updates

    Hi All,
    I have a requirement where in I have to use batch updates. But if there's a problem in one of the updates, I want the rest of the updates to ingore this and continue with the next statement in the batch. Is this not one of the features in BatchUpdates in JDBC2? I have been trying to accomplish this since 2 days now. Can anyone help me with this. Can anyone please help me with this?
    FYI, I have tried the following.
    I have 3 test updates in my batch.
    2 nd statement is an erraneous statement(deliberate). Other 2 statements are fine. It is appropriatley throwing 'BatchUpdateException'. when I ckeck the "arrays of ints" reurned by executeBatch() as well as BatchUpdateException.getUpdateCounts() are returning an arrays of size '0'. If remeove the erraneous statement, behaviour is as expected.
    Thanks in advance,
    Bharani

    The next paragraph of the same API doc:
    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:
    3. 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
    A driver is not required to implement this method.

  • Cs6 problem with batch from raw to jpg

    hello
    I recently have problem when I want to batch raw files in bridge and convert them to jpg. it gives me errow message as: The command "Save" is not currently available. (-25920)
    I try all possible ways but it doesn't work. I try to process files - script- image processor but in this way doesn't work eather. different computer works just fine with same files and using same workflow.
    Just few weeks back I was able to do all my work without problem. Please HELP,HELP,HELP
    Bibi

    Andrew Shalit wrote:
    I used iPhoto for many years and found it to be cumbersome and more trouble than it was worth.  It did not let me manage, organize, rate, tag, and edit my photos in any way approaching convenience. 
    Hate to say this for the 3rd time, but use Canon's "DPP" (Digital Photo Professional).
    With it you can "manage, organize, rate, tag, and edit [your] photos" as well as batch convert to jpeg or othet formats.

  • Problem with Batch Resizing in CS3

    I have a bunch of .jpeg pictures I want to resize.  I created a new action, I went to File - Automate - Fit Image and set the size to 1920x1080, closed but did not save the image. Then I stopped the action.
    Then I went to File - Automate - Batch and set the Action to my new action, set up the source and destination folders and clicked OK.
    However, after resizing the first picture in the source folder, I get the JPEG quality window opening and when I click ok, it just keeps opening the JPEG quality window after each picture is resized.
    Is there anyway to prevent this jpeg quality window from opening each time, so the action just resizes all the pictures ?  I'm using CS3 Photoshop?
    Thanks in advance,
    John Rich

    That could be a video card problem, so run a check on it.
    If changing drives be sure to deactivate CS3 before doing this (in Help menu).  Then activate once installed on new HD.  Best to do this with disks rather than just file transfer.

  • Problems With Batch Actions

    I have two actions that I built. They have worked fine for the past several months to a year.. Now all of a sudden the action will not work when run on a batch but it will work when run on a single photo. any ideas? I'm not even sure where to begin to start trouble shooting this problem.
    Thank you!!
    Amanda

    I'm using cs6 which is the same version the actions were created in. I use two different actions. The first one resizes a photo and the second one adds a frame around the photo with our company logo on it. the second one is the one that is not working. It works fine on a single photo but not on the batch action. I've attached a sample. The first one was run on a single photo and the second one was run on a batch.

  • Problems with batch in fpc 5

    I have a large project with many clips and sequences.
    I dont want to batch everything right now.
    Can i remove the funtion "add additional items found window" that shows up every time when youre about to batch something?
    This function takes me about 2-3 minutes to just go thru all the items in my large project(140mb).
      Mac OS X (10.3.9)  

    I must say, it's a bit difficult to understand your problem exactly if you don't give many details and it's also more inviting for someone to offer help.
    Look, your project is wayyyy!!! too big. But, maybe it needs to be, who knows? Either way, I think your talking about "batch capturing" only select clips at a time. If so, create a seperate bin and drag only those inside of it. Make that bin your LOGGING BIN-control>set logging bin. The program will disregard other clips. I've done this myself on huge project.
    If this is not what you're referring too, then refer to top of this post.
    Peace

  • Problem with batch inputs

    Dear All
    Could you advise me, we have many batch inputs stored in our system, some of them are very old one.
    What is SAP recommendation?
    How long batch inputs should be stored?
    Maybe you have some experience in this matter and can advice us>
    Thank you in advance for your help.
    Best regards
    Maja

    Hi Maja,
    if you double click on each batch input session, u will find the status, (Error, Processed, Not Message). u can delete the batch inputs whose status is Error or no message. those are all not in use. Even if you leave that also not a problem.
    U can find the status in 2nd Column, if the 2nd column has symbles like (Execute, Create and Error). Based on that also u can find the status.
    Kumar

Maybe you are looking for