GET_HASH Function
This function computes a hash value for all given values. Use this function to implement lost update detection for data records.
Syntax
APEX_UTIL.GET_HASH (
p_values in apex_t_varchar2,
p_salted in boolean default true )
RETURN VARCHAR2;
Parameters
Table 35-47 GET_HASH Parameters
Parameter | Description |
---|---|
|
The input values. |
|
If true (the default), salt hash with internal session information. |
Example
declare
l_hash varchar2(4000);
begin
select apex_util.get_hash(apex_t_varchar2 (
empno, sal, comm ))
into l_hash
from emp
where empno = :P1_EMPNO;
if :P1_HASH <> l_hash then
raise_application_error(-20001, 'Somebody already updated SAL/COMM');
end if;
update emp
set sal = :P1_SAL,
comm = :P1_COMM
where empno = :P1_EMPNO;
exception when no_data_found then
raise_application_error(-20001, 'Employee not found');
end;
Parent topic: APEX_UTIL