locked
No Data Found while inserting data into child table RRS feed

  • Question

  • User-1685971342 posted

    Hi All,

    I am getting no data found while inserting data into a child table. I searched for this in the net, but it did not help much. I will give a small example.

    v_pk number(10);

    select seq1.nextval into v_pk from dual;

    insert into parent(col1,col2,col3) values(v_pk,val2,val3);

    insert into child(col1,col2,col3,col4) values(seq2.nextval,v_pk,val3,val4);

    comit;

    Can somebody please tell why the error might come when the child table insertion is happening. In other discussions in the net, they say "select into" will cause the error. But how I can solve it?

    Please help!

    Friday, October 28, 2011 6:19 AM

Answers

  • User269602965 posted
    insert into {schemaname}.parent(col1,col2,col3) values({schemaname}.seq1.nextval,val2,val3);
    commit;
     
    insert into {schemaname}.child(col1,col2,col3,col4) values({schemaname}.seq2.nextval, {schemaname}.seq1.currval,val3,val4);
    commit;
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 29, 2011 5:39 PM

All replies

  • User269602965 posted

    commit;

    it is misspelled in your code example

     

    if that is not the problem, show your code calling the PL/SQL and the PL/SQL code,

    to make sure you are passing parameters properly

    Friday, October 28, 2011 11:24 AM
  • User651454269 posted

    I didn't try But if there is problem it just use following way

    v_pk := seq1.nextval;

    Saturday, October 29, 2011 2:45 AM
  • User269602965 posted
    insert into {schemaname}.parent(col1,col2,col3) values({schemaname}.seq1.nextval,val2,val3);
    commit;
     
    insert into {schemaname}.child(col1,col2,col3,col4) values({schemaname}.seq2.nextval, {schemaname}.seq1.currval,val3,val4);
    commit;
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 29, 2011 5:39 PM