1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| declare
t_sysreg_id system_registry.sysreg_id%type;
CURSOR C_PARENT IS
SELECT * FROM SYSTEM_REGISTRY
WHERE SYSREG_ID = :local.selected_node;
R_PARENT SYSTEM_REGISTRY%ROWTYPE;
cursor c_sysreg is
select 1 from system_registry
where sysreg_id = :leaf_block.sysreg_id
for update of description,sysreg_data
nowait;
r_sysreg c_sysreg%rowtype;
cursor c_unique(
p_parent_desc varchar2,
p_description varchar2,
p_company_code varchar2,
p_department_code varchar2,
p_point_code varchar2,
p_user_id varchar2
) is
select sysreg_id from system_registry
where upper(parent_desc) = upper(p_parent_desc)
and upper(description) = upper(p_description)
and nvl(upper(company_code),' ') = nvl(upper(p_company_code),' ')
and nvl(upper(department_code),' ') = nvl(upper(p_department_code),' ')
and nvl(upper(point_code),' ') = nvl(upper(p_point_code),' ')
and nvl(upper(user_id),' ') = nvl(upper(p_user_id),' ');
r_unique c_unique%rowtype;
e_handled exception;
begin
-- update existing...
for a in 1..10 loop
begin
message ('open');
open c_sysreg;
message ('open OK');
exit;
exception
when others then
if sqlcode = -54 then
if a = 10 then
pl_debug.display('Could not lock entry for update');
raise e_handled;
end if;
else
pl_debug.display('SQL error ' || sqlcode || ' trying to lock registry entry');
raise e_handled;
end if;
end;
end loop;
fetch c_sysreg into r_sysreg;
if c_sysreg%found then
message ('c_sysreg%found');
message ( :editleaf.description);
message (:editleaf.sysreg_data);
message (:leaf_block.sysreg_id);
begin
update system_registry
set description = :editleaf.description,
sysreg_data = :editleaf.sysreg_data
where current of c_sysreg;
commit;
message ('commit');
exception when others then
message (sqlerrm);
end;
else
message ('Error locating registry entry, refresh and retry');
message ('Error locating registry entry, refresh and retry');
pl_debug.display('Error locating registry entry, refresh and retry');
end if;
close c_sysreg;
-- end if;
standard.commit;
message ('Populate_Leaves');
Populate_Leaves;
message ('hide_window');
hide_window('WIN_EDITLEAF');
go_block('tree_block');
exception
when e_handled then
null;
when others then
pl_debug.display('Unexpected SQL error ' || sqlcode || chr(10) || sqlerrm(sqlcode));
if c_sysreg%isopen then
close c_sysreg;
end if;
if c_parent%isopen then
close c_parent;
end if;
end; |
Partager