Problem with a prepared statement

Hi all

I'm trying to insert a row in a database using a statement prepared as follows

                String [] test = tester; for(int i = 0; i < employ.length; i++){ System.out.println(test);
}
String query = "insert into testing values(?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement ps = null;
try{
ps = con.prepareStatement(query);
if(connected){
for(int i = 0; i < test.length; i++){
String val = test[i];
ps.setString(1, val);
ps.executeUpdate();
}
}
}catch(SQLException se){
displayErrors(se);
}
Yet when I try to insert using this code I get a SQL exception SQL Exception: No value specified for parameter 2 I am not entering null's as that first for loop is to check and print out the contents of the array to the console to check for that. All the information is in the array, so I guess my question is how is there no value for parameter 2 when the array is full?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

801330 wrote:

ps.setString(1, val);
ps.executeUpdate();

Yet, when I try to insert using this code, I get an SQL exception

The SQL Exception: No value specified for parameter 2

I am not entered null value because this first loop must check and print the content of the table on the console to verify that. All the information is in the table, so I guess my question is how is there no value for parameter 2 when the table is full?

Because (1) you never set just the first parameter (2) don't you really want to run the PS each time through the loop? Isn't it? I have not guessed not.

DB

Tags: Oracle

Similar Questions

  • What is the problem with this WHERE statement?

    What is the problem with this WHERE statement?

    < cfquery datasource = "manna_premier" name = "kit_report" >
    SELECT SaleDate,
    TerritoryManager,
    Distributor,
    DealerID,
    Variable,
    US_Dealers.ID,
    DealerName,
    DealerAddress,
    DealerCity,
    DealerState,
    DealerZIPCode
    Orders, US_Dealers
    WHERE US_Dealers.ID EQ DealerID AND SaleDate BETWEEN #CreateODBCDate (FORM. Implementation) # AND #CreateODBCDate (FORM. End) #.
    ORDER BY SaleDate
    < / cfquery >

    It's driving me crazy!

    Syntax error (missing operator) in query expression ' US_Dealers.ID EQ DealerID

    You accidentally use the CF equals operator: "EQ".

    Instead of MS Access: «=»

    [Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver]...

    in a query expression. AND SaleDate BETWEEN #10/1/2009 #-October 18, 2009 #'.

    I don't see how CreateODBCDate() would produce these values.  But maybe it's just a quirk of the error message?

  • Specific problem with pimples and States

    Hello

    I firstly apologize for use Google Translate :-(

    I have a problem with InDesign does not resolve. That's a digital publication.

    My goal is:

    A 'Gallery' button and the image of the ball appears with three buttons: "Previous Image", "Next Image" and "narrow Gallery.

    I don't want the Gallery either visible, or buttons that control, until the 'Gallery' button, so I think that all the buttons except 'Gallery' by selecting the option 'hidden until this active'.

    I want the gallery and the buttons that control, disappears when I press the "Close Gallery" button.

    What I call 'Gallery' is an image that fills the screen.

    After you have placed the image on your site have become the button property "Hidden until this that active."

    Then convert this key in order to several States (what I will call 'button States') and by successive Governments with the pictures I want to show in the gallery.

    I think that the interactions between the buttons.

    When the 'Gallery' button I attribute the following "I click on the '.

    -"Go to the State."

    -Hide the "Gallery".

    -Show 'narrow Gallery.

    -Show "previous image".

    -Show "next image".

    -Show "States of the button.

    "Previous Image" and "Next Image" buttons are assigned, respectively, to go to the previous state and go to the next State.

    When "Close Gallery" button I attribute the following "I click on the '.

    -Show "Gallery."

    -Hide 'narrow Gallery.

    -Hide "previous image".

    -Hide "next image".

    -Show "States of the button.

    "Previous Image" and "Next Image" buttons are assigned, respectively, to go to the previous state and go to the next State.

    When "Close Gallery" button I attribute the following "I click on the '.

    -Show "Gallery."

    -Hide 'narrow Gallery.

    -Hide "previous image".

    -Hide "next image".

    -Hide the "States of the button.

    I put it to the top and works correctly until I press "close". Then I hide buttons "Close Gallery", "previous image" and "next image" but it keeps me visible "Button States" showing the last image that was shown.

    Don't know how to solve this problem, and I'm going crazy!

    Please can someone help me?

    Maybe the solution is another approach, but without using "Folio overlays.

    Thank you very much.

    I moved your post to the DPS forum.

    I'm afraid of how you do this will not work with DPS.

    This should all be done with a multi state object. The first State would contain anything other than a button to access the first State. After that, set up each State with the appropriate buttons. Without seeing the file, it's a little hard for me to imagine exactly what you want to do.

  • Problem with 'if - ElseIf' statement with the mouse, click.

    I'm having a problem with the code IF ELSE use with a mouse click. I want whenever a user 'clicks' I want to run a particular block of code, up to 3 clicks, then nothing. I tried var meter click local and global but can't seem to cross the first '' if. '' That's what I have now (I use console.log () to keep track.

    Ready model I create a global var...

    Enter the code to run when the composition is fully charged here
    sym.getComposition () .getStage () .setVariable ('clickcnt', 1); //Set 1 meter

    var i = sym.getComposition () .getStage () .getVariable ('clickcnt');

    Console.log ("count starts at"+ i ");


    on the stage, I create an event 'click '...

    Insert the code for the mouse, click here
    var i = (sym.getComposition () .getStage () .getVariable ('clickcnt');)
    If (i = 1) {}
    Console.log ("counter is =" + i);
    c code
    sym.getComposition () .getStage () .setVariable ('clickcnt', 2); //Set against 2
    }
    ElseIf (i = 2) {}
    Console.log ("counter is =" + i);
    c code
    sym.getComposition () .getStage () .setVariable ('clickcnt', 3);
    //Set against 3
    }
    ElseIf (i = 3) {}
    Console.log ("counter is =" + i);
    c code
    sym.getComposition () .getStage () .setVariable ('clickcnt', 4);
    //Set against 4 to take away
    SYM. Play (100); //play scenario animation
    }
    else { //I'm using it to deny any additional clicks.} I don't know there is a good way to do this. I don't know him
    SYM. Stop (1000);
    Console.log ("End");
    }
    ;

    I when I run this it never happened the first if it's like the 'clickcnt' var is not getting updated or read correctly.

    Thank you

    Joel H

    try if (I == 1) double equal.

  • Problems with my timed State machien

    Hi all

    The project

    I'm trying to create a timed state machine that can scroll through a series of cooling-then-heating cycles, where every cold or heat function occurs during a specific period of time.
    For example, if I set the number of cycles to 20 cycles 'cool-then-heat', with a cool cycle lasts 10 seconds and a cycle of prolonged heat of 10 seconds, the program will run for 400 seconds and then stops.

    After initialization, a clock will start. In the cool loop, there will be a cool clock which is compared to all of the cool cycle time. If they are equal, continuous cooling, noto, if they are equal the progresses of program in a heat cycle.

    The cycle has estrogen to a clock of heat that will be compared to the heat set duration of the cycle. If hot clocks are not equal, heating continues, if they are equal the cycle estrogen is complete and the product is finished or running in another round of cool.

    Another round of cool is selected if the elapsed time (since the State apparatus has been initialized) matches both total managed program (i.e. the total length = 400 seconds).

    (I've also attached a drawing that explains the process I want schematically the state machine).

    The problem

    I have a few, but the first is I think I use the block of bad timing - in my VI, the clock of the tick is not starting from scratch when I press run. It is included in a while loop as I have reason to think it will be easier to run (for the computer) if I put a delay (without delay the state machine functions). Rather than from

    I have a small calculator that determines how long will be the run time in total (this value is compared to the length of time since the entry into force).

    If anyone no matter what other tasks that help sadjusting need me know - I'm very new to labview and want to pick up good practices on the way!

    There is also the express VI "out of time", you could use.

  • Problem with insert/update statements on the MS Access database

    Hi all

    Before posting this question, I did a search and found this thread.

    I have the same problem as pawel had (in this thread), i.e. cannot insert or update data in the Access database. However, the reason is not that I am using some keywords in my domain name - it has been several years using SQL, some things are 'unwritten' rules But this is the first time I try something in LV

    However, after losing all day for work that I expect to do the same morning in 1 hour, try many different options and debugging until the level low in the Toolbox of data base screw (building or higher), I saw some weird SQL statement being trained in-house - so I tried what Troy has tried.

    "password" is a reserved word in the Jet.  I just looked at MOManagers_M, but by changing the field "password" to 'passworda', it does the job.

  • Problems with the switch statement

    There everyone,

    I tried to build a page with 4 buttons. Each button is a symbol that contains 2 png´2 who are the drawings of the key. If you click on the button 1, he has to move on the screen. If you click it again it should back off. and if you click on another button button1 is active then button1 should return to the starting position and button 2 should come on the screen.

    I use a switch statement and a variable.

    composition ready, I used

    sym.setVariable("current","");

    to set the Variable

    each button (one of the png within the symbols), I used:

    var = sym.getComposition.getStage.getVariable ("current") courses;

    switch (current)

    {

    case ' ':

    SYM. Play ("in");

    break;

    case button1:

    SYM. Play ("out");

    break;

    by default:

    sym.getComposition.getStage.getSymbol (current) ("out") .play;

    SYM. Play ("in");

    break;

    }

    announcement each animation buttons are labels for the entrance and animation. There are also triggers that change the current variable on the stage

    sym.getComposition.getStage.setVariable ("current", "button1");

    If I test inside a browser and click the button nothing happens.

    I m what do not know my mistake.

    can someone help me?

    concerning

    Mr.Monsen

    Hello

    Some errors of syntax in red:

    class var = sym.getComposition () .getStage () .getVariable ("current");

    switch (current)

    {

    case ' ':

    SYM. Play ("in");

    break;

    case "button1":

    SYM. Play ("out");

    break;

    by default:

    sym.getComposition () .getStage () .getSymbol (current) ("out") .play;

    SYM. Play ("in");

    }

    sym.getComposition () .getStage () .setVariable ("current", "button1");

  • Problem with analysis - union statement

    Hi all

    I have an analysis where I use the union statement. I have 4 columns in the result and 4 columns in select statements.
    Each select statement is a single equipped with filters.
    The results are presented in two rows. In my understanding it #of of columns and type paired in the union statement, I should get 1 row of results (summary of the two).

    How can I check in BI which is the cause two appear in two lines instead of 1?

    Thank you.

    Published by: user8461308 on April 13, 2012 03:13

    Set property of a measure to pivot as SUM aggregation. If all the attributes displayed in 'Row' are exactly the same, OBIEE apply group by making the data.

    See you soon...

    Patrick
    [http://obieetipsandconcepts.blogspot.com/]

  • problem with sql default_where statement

    Hello gurus


    I use forms 6i, shaped with blocks of data AREA and the area euro1, their sources of data are derived from a table of unique 'space '.

    right side of the form displays the list of all the domain names (one attribute in a table) inserted before the trigger of when_new_form instance (i.e. Grenier1 block).

    by clicking on: AREA1.NAME I want to execute the details of corner table block area...

    to do this, I specified trigger on_mouse_click
       go_block('area');
       execute_query;
    and I call it a procedure on prior request

    Matching(:Area1.Name);


    Code of procedure of correspondence is

    PROCEDURE matching(c_name in varchar2) IS
    sql_state varchar2(100);
    BEGIN
      
      
      
       ----- if not null then
            
            if c_name is not null then 
            sql_state := 'UPPER(name)  like ''%'''||UPPER(c_name)||'''%'''; 
                     set_block_property('area',default_where,sql_state);     
            else
                  message('feild is empty');
                  end if;
             exception when others then
                  display_error;
      
      
    END; 
    It works only 2 or 3 times, but now it gives me the error FRM-40505 unable to execute the query
    There is no any element non-base of data on two blocks of

    What can be the problem, please


    Thank you
    like ''%' ||UPPER(c_name)|| '%''';
    
  • Problem with a declare statement

    Hello

    I don't get the right output by using the code below. Can you please help?

    declare
    number of v_aer1;
    number of v_var1;
    number of v_var2;
    cursor c1 is
    Select a.aer_id, a.seq_text in v_aer1, aer_text v_var1 an a.FIELD_ID WHERE the = 101506 and aer_id group 103000005274 by a.seq_text, a.aer_id, rowid = rowid in
    (select min (rowid) in the aer_text where FIELD_ID = 101506 and aer_id = a.aer_id);
    Start
    I'm in c1
    loop
    For J in (select min (seq_text) in the v_var2 of aer_text where FIELD_ID = 101506 and aer_id = 103000005274)
    loop
    If v_var1! = v_var2 then
    insert into test_today values (v_aer1, v_var1);
    end if;
    end loop;
    end loop;
    Exception when others then
    Dbms_Output.put_line (' error ' |) SQLERRM);
    End;


    If you have any questions please let me know.

    Thank you

    Pravin.

    Published by: BSM on December 8, 2011 23:34

    Published by: BSM on December 8, 2011 23:38

    Leaving aside the intent of the code, which could certainly be done with a single INSERT statement, if I understand what you're doing, the variables you declare and use in cursor statements are not actually met.

    SQL> declare
      2     l_v number;
      3     cursor c1 is
      4        select 1 col into l_v from dual;
      5  begin
      6     for i in c1 loop
      7        dbms_output.put_line('Col is: '||l_v);
      8     end loop;
      9  end;
     10  /
    Col is:
    
    PL/SQL procedure successfully completed.
    

    When you use a loop of implicit cursor like this, you need to refer to the record of cursor that is created for you. So, your code should look similar to this point is syntactically correct and at least semi-utile.

    declare
       cursor c1 is
          select a.aer_id, a.seq_text
          from aer_text a
          WHERE a.FIELD_ID = 101506 and
                aer_id = 103000005274
          group by a.seq_text, a.aer_id, rowid
          having rowid in (select min(rowid) from aer_text
                           where FIELD_ID = 101506 and
                                 aer_id = a.aer_id);
    begin
       for i in c1 loop
          For J In (select min(seq_text)
                    from aer_text
                    where FIELD_ID = 101506 and aer_id = 103000005274) loop
             if i.seq_text != j.seq_text then
                insert into test_today values(i.aer_id, i.seq_text);
             end if;
          end loop;
       end loop;
    End;
    

    I was really very surprised to find that the in the variable bits in your cursor definitions do not throw an error in compiling.

    John

  • Problem with button 'Over' State

    I am just learning flash. I created a rectagle and converted to a button symbol. I got it so that it changes color when someone will find their mouse over it. However, I need the text there, too. My problem is that the symbol comes back to its original color when the mouse is over the text. I tried to make the text in the symbol, and I also tried to put above the symbol on the stage.

    I need the rectangel to stay in his "Over" State even when the mouse is over the text. Is this possible?

    Ian

    In the properties panel, make sure that the TextField is not defined to be selectable.  There is an icon it for this property activation or deactivation.

  • Problem with the MERGE statement

    Hi all

    We'll cover the following:

    create table xx_test1 (invoice_id number, line_group_number number, LINE_TYPE_LOOKUP_CODE          VARCHAR2(25) ,LINE_NUMBER                    NUMBER(15)  );
    

    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,1,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,1,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,2,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,2,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,3,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,3,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,4,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,4,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,5,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,5,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,12,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,12,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,7,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,7,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,8,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,8,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,9,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,9,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,10,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,10,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,11,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,11,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,12,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,12,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,13,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,13,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,14,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,14,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,15,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,15,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,16,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,16,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,17,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,17,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,18,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,18,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,19,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,19,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,20,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,20,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,21,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,21,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,22,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,22,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,23,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,23,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,24,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,24,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,25,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,25,'TAX',null);
    

    So, if we want to MERGE this table and update the lines with below:

    merge into xx_test1 DST
             USING (SELECT  LINE_GROUP_NUMBER,
                  LINE_TYPE_LOOKUP_CODE,
                  ROW_NUMBER() over(order by LINE_TYPE_LOOKUP_CODE, LINE_GROUP_NUMBER) as LINE_NUM
             from xx_test1
            where INVOICE_ID = 131549
           
                 ) SRC
          ON (DST.LINE_GROUP_NUMBER = SRC.LINE_GROUP_NUMBER AND dst.LINE_TYPE_LOOKUP_CODE = src.LINE_TYPE_LOOKUP_CODE AND dst.invoice_id = 131549 )
          WHEN MATCHED THEN
             update
                set DST.LINE_NUMBER = SRC.LINE_NUM
                ;
    


    I get an error message:

    SQL error: ORA-30926: failed to get a stable set of rows in the source tables

    30926 00000 - "impossible to get a stable set of rows in the source tables.

    * Cause: A stable set of rows could not be achieved due to the large dml

    activity or one not deterministic where clause.

    * Action: Remove any non deterministic of the clauses and reissue of the dml.

    I don't know why I'm getting this. Any ideas?

    Version: 11g

    Kind regards

    Alex

    whenever I have this error I convert my fusion in a select to see what is duplication

    select dst.LINE_GROUP_NUMBER, dst.LINE_TYPE_LOOKUP_CODE, count(*)
    from xx_test1 DST
    join (SELECT  LINE_GROUP_NUMBER,
                  LINE_TYPE_LOOKUP_CODE,
                  ROW_NUMBER() over(order by LINE_TYPE_LOOKUP_CODE, LINE_GROUP_NUMBER) as LINE_NUM
             from xx_test1
            where INVOICE_ID = 131549
         ) SRC
     ON (DST.LINE_GROUP_NUMBER = SRC.LINE_GROUP_NUMBER AND dst.LINE_TYPE_LOOKUP_CODE = src.LINE_TYPE_LOOKUP_CODE AND dst.invoice_id = 131549 )
    group by dst.LINE_GROUP_NUMBER, dst.LINE_TYPE_LOOKUP_CODE
    having count(*) > 1
    

    you have 2 dst. LINE_GROUP_NUMBER, summer time. Combination of LINE_TYPE_LOOKUP_CODE this duplication.

  • problems with an if statement

    well, here it is guys: function popLoop (popArray, tracerArray) {}
    for (n = 0; n < popArray.length; n ++) {}
    trace (popArray.Length);
    trace (n);
    If (n = popArray.length) {}
    trace("sure");
    }
    }
    }

    popArray.length = 3 FYI

    So whats happening is I want the statement to execute via "popArray.length" [3] times.
    the loop contains commands to duplicate movies, but the thing is it stops after the end if statement.

    Anyone know why the if statement stops the loop for?

    use the double equal (==) to test for equality.

  • problem with the insert statement

    Hi all

    I'm trying to insert data into xxops_forecast_extract.
    There are two additional territory_id, position_id columns.
    How can I insert data into xxops_forecast_extract with the update instructions below.
           Columns of XXOPS_FORECAST_EXTRACT 
    
            PERIOD_ORDER,           
            SHR_NODE_ID,         
            FORECAST_DEFN_ID,       
            X_SALES_REP_NUM,        
            X_SALES_REP_REF,        
            POSITION_NAME,          
            TERRITORY_NAME,         
            AM_ID,              
            POSITION_LEVEL,         
            FORECAST_ID,            
            PERIOD_ID,              
            FISCAL_PERIOD,         
            PERIOD_START_DATE,      
            PERIOD_END_DATE,        
            TOTAL_COMMIT_PRODUCT,   
            TOTAL_JUDGMENT_PRODUCT,
            TOTAL_COMMIT_SERVICE,   
            TOTAL_JUDGMENT_SERVICE,
            TOTAL_UPSIDE_PRODUCT,   
            TOTAL_UPSIDE_SERVICE, 
            TERRITORY_ID,
            POSITION_ID
        INSERT INTO xxfdev.xxops_forecast_extract(
            PERIOD_ORDER,           
            SHR_NODE_ID,         
            FORECAST_DEFN_ID,       
            X_SALES_REP_NUM,        
            X_SALES_REP_REF,        
            POSITION_NAME,          
            TERRITORY_NAME,         
            AM_ID,              
            POSITION_LEVEL,         
            FORECAST_ID,            
            PERIOD_ID,              
            FISCAL_PERIOD,         
            PERIOD_START_DATE,      
            PERIOD_END_DATE,        
            TOTAL_COMMIT_PRODUCT,   
            TOTAL_JUDGMENT_PRODUCT,
            TOTAL_COMMIT_SERVICE,   
            TOTAL_JUDGMENT_SERVICE,
            TOTAL_UPSIDE_PRODUCT,   
            TOTAL_UPSIDE_SERVICE )
        SELECT 
            PERIOD_ORDER,           
            NODE_REFERENCE,         
            FORECAST_DEFN_ID,       
            X_SALES_REP_NUM,        
            X_SALES_REP_REF,        
            POSITION_NAME,          
            TERRITORY_NAME,         
            AM_NAME1,               
            POSITION_LEVEL,         
            FORECAST_ID,            
            PERIOD_ID,              
            FISCAL_PERIOD,          
            PERIOD_START_DATE,      
            PERIOD_END_DATE,        
            TOTAL_COMMIT_PRODUCT,   
            TOTAL_JUDGMENT_PRODUCT,
            TOTAL_COMMIT_SERVICE,   
            TOTAL_JUDGMENT_SERVICE,
            TOTAL_UPSIDE_PRODUCT,   
            TOTAL_UPSIDE_SERVICE   
        FROM ESALESFCST.OMF_FORECAST_DATA_FDEV@XXG2C_ECRMS_FDEV_ADMIN.COMPANY.COM;
    
          
         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;
        COMMIT;
    Thanks in advance.

    You can try with the merger?

  • Problem with the update statement

    Hello

    Can someone tell me please the difference between

    H1. Select s.name, s.id, d.id, d.name in s, d where s.id = d.id;

    and

    H1. Select s.name, s.id, d.id, d.name in s d on s.id = d.id inner join;

    They give me the same result, but I would like to know how it works internally.

    And also

    update source X set name =)
    H3. Select Y.name in the destination Y where X.id = Y.id
    )
    where X.id in (select destination id);

    Is doing an update

    but when

    update source set name =)
    H3. Select Y.name in the destination source Y X on X.id = Y.id inner join
    )
    where X.id in (select destination id);

    using the above query, I get an error message stating "only query returns multiple lines.

    What is the error that I commit here?

    Thanks in advance

    Sana

    Assuming that table destination has PK/UK on id:

    SQL> create table source(id number,name varchar2(10));
    
    Table created.
    
    SQL> insert into source(id) select empno from emp
      2  /
    
    14 rows created.
    
    SQL> create table destination(id number,name varchar2(10));
    
    Table created.
    
    SQL> insert into destination select empno,ename from emp
      2  /
    
    14 rows created.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> update (select s.id,s.name s_name,d.name d_name from source s inner join destination d on s.id = d.id)
      2  set s_name = d_name
      3  /
    set s_name = d_name
        *
    ERROR at line 2:
    ORA-01779: cannot modify a column which maps to a non key-preserved table
    
    SQL> alter table destination
      2    add constraint destination_pk
      3      primary key(id)
      4  /
    
    Table altered.
    
    SQL> update (select s.id,s.name s_name,d.name d_name from source s inner join destination d on s.id = d.id)
      2  set s_name = d_name
      3  /
    
    14 rows updated.
    
    SQL> select * from source
      2  /
    
            ID NAME
    ---------- ----------
          7369 SMITH
          7499 ALLEN
          7521 WARD
          7566 JONES
          7654 MARTIN
          7698 BLAKE
          7782 CLARK
          7788 SCOTT
          7839 KING
          7844 TURNER
          7876 ADAMS
    
            ID NAME
    ---------- ----------
          7900 JAMES
          7902 FORD
          7934 MILLER
    
    14 rows selected.
    
    SQL> 
    

    SY.

Maybe you are looking for

  • Audit failure Microsoft Windows security. 4625 login

    Passe spent Review Journal windows 2008 r2, that is windows 7 from two computers constantly try to start the session. I spent the antivirus, antispyware, malware, etc and detect any virus, Trojan horse, worm, on computers. You can help resolve makes

  • Microsoft automated troubleshooting error attached start-up services has stopped working

    I would like someone from Microsoft to please solve this problem once and for all: "microsoft automated troubleshooting error attached start-up services has stopped working. I tried the fix and nothing works... Please help

  • Internet connections

    I reinstalled my windows vista program, and now I can't connect to internet/aol as it says no device found... login help!

  • 4.2.1 in Eclipse

    Is there a way to make this work?  I know that RIM says only 4.3 + can be used in Eclipse, but I have heard people use Netbeans, which is obviously not supported, so I thought using Eclipse with older versions would be possible.  The lack of refactor

  • Synchronization of databases ACS!

    Hi all. I have 2 windows machines running acs 4.1. I install just the second machine in a new region. I want to know what will I do on all 150 routers, I added? is it possible to some how synchronize two acs servers such that when one goes down, anot