Tabular Form Insert Data Using Loop

How to manually insert Tabular form data.

IN THIS TUTORIAL YOU WILL LEARN HOW TO INSERT TABULAR FORM DATA INTO DATABASE USING LOOP.

A legacy tabular form enables users to update multiple rows in a table at once from a single page. When created using a wizard, a legacy tabular form enables you to perform update, insert, and delete operations on multiple rows in a database table. Tabular forms include a built-in multiple row update process that performs optimistic locking behind the scenes to maintain the data integrity.
 

Working

This tutorial will guide you to insert Tabular Form data into database using a loop.

After creating a tabular form follow below steps.

For manual insertion you will need to create a page process.

Go to processing tab and create a page process.

Script:

In this below script I am going to check tabular form data available in database against each user. If found then update record else it will perform insert.


declare

  v_chk number;

begin

  for i in 1 .. htmldb_application.g_f02.count loop /* Count total available tabular form rows where 

“f02” is the name of column, Check below how to find Tabular Form column name. */


    begin


      select 1

        into v_chk

        from EMPLOYEE

       where EMP_ID = htmldb_application.g_f02(i);


      update EMPLOYEE

         set EMP_NAME     = htmldb_application.g_f03(i), 

             SALARY             = htmldb_application.g_f04(i),

             COMMISSION   = htmldb_application.g_f05(i),

             TOTAL_SALARY = htmldb_application.g_f06(i)

       where EMP_ID = htmldb_application.g_f02(i);


    exception

      when no_data_found then


        insert into EMPLOYEE

          (EMP_NAME, SALARY, COMMISSION, TOTAL_SALARY)

        values

          (htmldb_application.g_f03(i),

           htmldb_application.g_f04(i),

           htmldb_application.g_f05(i),

           htmldb_application.g_f06(i) 

          );

    end;


  end loop;


end;

 

How to find Tabular Form column name
htmldb_application.g_f02(i)

To check Tabular Form column name find below steps.

1) Right click on column

2) Click on “Inspect Element

3) In HTML check name attribute.

<input type=”text” name=”f02″ size=”5″ maxlength=”2000″ value=”161″ class=”u-TF-item u-TF-item–text readonlyfield” readonly=”readonly” style=”text-align: center;” id=”f02_0001″ autocomplete=”off”>

Comment below if you found this tutorial helpful

1 thought on “Tabular Form Insert Data Using Loop”

Leave a Comment

Your email address will not be published. Required fields are marked *