'how to insert one table record value to other table using oracle form as a mediator

i have two tables :

table1( columns as id, name, mail, address) and table2(eid, name, mail and salary)

i have created data block for each table (name datablock1 and datablock2). Table2 is a new table and the form have some fields like name, mail, address which gets data from table1.

Now when i save the form with some values in fields the similar data(name, addresss) from table should be inserted to table1.

i'm using below code but it is not saving data to table1 ;

  1. is there any other way to insert data to table1 ?
  2. please elaborate how to go further ?
BEGIN
  INSERT INTO table1
    (ID,
     name,
     mail,
    address)
  VALUES
    ( SEQ.NEXTVAL,
     :datablock2.name,
     :datablock2.mail,
     'sometxt');
  COMMIT;
END;


Solution 1:[1]

During the creation of a Database Block through use of the Data Block Wizard, it would ask you to provide a table name(namely table1 in this case), and its columns.

After creation, you'll see

  • Database Data Block under Database node of the property palette set to Yes
  • Query Data Source Type to Table
  • Query Data Source Name to table1

And just click on the diskette icon after entering some data to the fields of the table1 block provided that the Menu Module under Functional node of the of the property palette of the form is set to DEFAULT&SMARTBAR

Otherwise, you just can add a button to a canvas with only having the code

COMMIT;

in order to save the entered data to the table by clicking on it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Barbaros Özhan