Databases Reference
In-Depth Information
PROCEDURE delete emp row (p message OUT VARCHAR2)
IS
v row INTEGER;
v count INTEGER := 0;
BEGIN
FOR i IN 1 .. apex application.g f01.COUNT
LOOP
v row := apex application.g f01 (i);
DELETE FROM emp
WHERE empno = apex application.g f02 (v row);
-- g f02 is the hidden column containing
-- the primary key of the EMP table (empno)
v count := v count + 1;
END LOOP;
p message := v count || ' row(s) deleted.';
END delete emp row;
END tab form emp pkg;
/
Let's work through an explanation of Listing 3-3. You need to do the following preparations for a
test:
1.
Create an application item T MESSAGE and set the session state protection to
Restricted - may not be set from browser. This application item will be used to
display messages. In a case of an ApplyMRD process, you have the substitution
strings like #MRD COUNT# or #MRI COUNT# or #MRU COUNT# . For a custom process,
you need a new variable.
2.
Set the existing ApplyMRD process to Conditional Never, so it doesn't run.
3.
Create a new On Submit Process PL/SQL anonymous block ApplyMRD
Manual and use the following code:
BEGIN
tab form emp pkg.disable foreign constraints;
tab form emp pkg.delete emp row (:t message);
END;
4.
Use the substitution string for the success message:
&T MESSAGE.
5.
Make the process conditional so it runs on condition type PL/SQL Expression:
:REQUEST IN ('MULTI ROW DELETE')
6.
Confirm and create a process.
 
Search WWH ::




Custom Search