The tutorial is given below to how to select multiple records in Oracle Forms.
In the following example, we will create a tabular data block based on the EMP table, a checkbox, a multiline textbox and a push button. We will give a functionality to the user that after executing the query, the user can select the records using checkbox and after clicking on the button, it will show the selected employee numbers in the multiline textbox.
Follow These Steps to Perform This Task
1. Create a tabular data block based on any table and open the layout editor.
2. In the layout editor, create a checkbox in the same tabular data block and set the following properties.
- Value When Checked: Y
- Value When Unchecked: N
- Database Item: No
- Initial Value: N
3. Create a Push Button and on the When-Button-Pressed Trigger, write the following code:
DECLARE v_string VARCHAR2 (4000); BEGIN GO_BLOCK ('emp'); FIRST_RECORD; LOOP IF :emp.c_cb = 'Y' THEN v_string := v_string || :emp.empno || ', '; END IF; IF :SYSTEM.LAST_RECORD = 'TRUE' THEN EXIT; END IF; NEXT_RECORD; END LOOP; FIRST_RECORD; :emp.selected_items := RTRIM (v_string, ', '); END;
Your form is ready now and you can test it by running it.
Also, you can download this form via the following link: