This discussion is archived
8 Replies Latest reply: Jan 29, 2013 4:13 AM by HamidHelal RSS

reg:insert statement.

Rajnish Chauhan Newbie
Currently Being Moderated
hi

i have push button on my form.
And on push button i have written insert statement .

after fill up the form when click on button its not getting any error.
but the records dont get insert into table.

-------------------------on push button--------
begin

insert into LOGINDETAILS (EMPID,     EMPFIRSTNAME ,EMPMIDDLENAME ,EMPLASTNAME , USERNAME , PASSWORD)

values ( seqlogindetails.nextval,          
:LOGINDETAILS.EMPFIRSTNAME,
                                                  :LOGINDETAILS.EMPMIDDLENAME,
                                                  :LOGINDETAILS.EMPLASTNAME,
                                                  :LOGINDETAILS.username ,
                                                  :LOGINDETAILS.Password
                                                       );
     ---commit;
     exception
          when dup_val_on_index then
          message(-20001,'duplicate data found');
          raise form_trigger_failure;
          when others then
          MESSAGE(SQLERRM);
          raise form_trigger_failure;
          
end;


please help.

Edited by: Rajnish Chauhan on Jan 29, 2013 3:11 AM
  • 1. Re: reg:insert statement.
    HamidHelal Guru
    Currently Being Moderated
    Rajnish Chauhan wrote:
    hi

    i have push button on my form.
    And on push button i have written insert statement .

    after fill up the form when click on button its not getting any error.
    but the records dont get insert into table.

    -------------------------on push button--------
    begin

    insert into LOGINDETAILS (EMPID,     EMPFIRSTNAME ,EMPMIDDLENAME ,EMPLASTNAME , USERNAME , PASSWORD)

    values ( seqlogindetails.nextval,          
    :LOGINDETAILS.EMPFIRSTNAME,
                                                      :LOGINDETAILS.EMPMIDDLENAME,
                                                      :LOGINDETAILS.EMPLASTNAME,
                                                      :LOGINDETAILS.username ,
                                                      :LOGINDETAILS.Password
                                                           );
         ---commit;
         exception
              when dup_val_on_index then
              message(-20001,'duplicate data found');
              raise form_trigger_failure;
              when others then
              MESSAGE(SQLERRM);
              raise form_trigger_failure;
              
    end;


    please help.

    Edited by: Rajnish Chauhan on Jan 29, 2013 3:11 AM
    Hi
    After your insert statement write
    forms_ddl('commit');
    Hope it works..
  • 2. Re: reg:insert statement.
    Rajnish Chauhan Newbie
    Currently Being Moderated
    Ya thanks it got inserted.
  • 3. Re: reg:insert statement.
    Rajnish Chauhan Newbie
    Currently Being Moderated
    why we use forms_ddl. why not commit.?
  • 4. Re: reg:insert statement.
    HamidHelal Guru
    Currently Being Moderated
    Rajnish Chauhan wrote:
    why we use forms_ddl. why not commit.?
    Commit is interpreted as COMMIT_FORM, then starts the Forms standard commit process, with validations, firing triggers,etc.
    Forms_DDL() just sends a command to the database, so nothing is done inside the Forms module.

    If you want to commit the whole form, use COMMIT. If you want to commit some extra code in the database, but without committing the form, use forms_ddl('commit')

    Hope it's clear..

    Hamid
  • 5. Re: reg:insert statement.
    Rajnish Chauhan Newbie
    Currently Being Moderated
    hi hamid
    ys its clear .

    but on form there are 3 text box and one button.
    whatever i have put into text and click on button it should insert into table right.
    so it should work as simple commit_form as well.

    help.
  • 6. Re: reg:insert statement.
    HamidHelal Guru
    Currently Being Moderated
    Rajnish Chauhan wrote:
    hi hamid
    ys its clear .

    but on form there are 3 text box and one button.
    whatever i have put into text and click on button it should insert into table right.
    so it should work as simple commit_form as well.
    Make database block base on table you want to insert and at button write simply
    commit_form;
    data will auto save in table


    Hope it helps


    Hamid
  • 7. Re: reg:insert statement.
    Rajnish Chauhan Newbie
    Currently Being Moderated
    hi hamid

    yes i have created data block only.
    user commit_forms its not giving any error but data not insert into table.
  • 8. Re: reg:insert statement.
    HamidHelal Guru
    Currently Being Moderated
    Rajnish Chauhan wrote:
    hi hamid

    yes i have created data block only.
    user commit_forms its not giving any error but data not insert into table.
    Hi
    Check the block property of data block
    Query Data Source Name <table_name>
    
    and the property of item
    
    under 
    Database Check 
    Column name
    Hope this helps

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points