1079: RAISE GLSTFL_fatal_err;
1080: END IF;
1081:
1082: -- get Oracle-assigned lock handle
1083: DBMS_LOCK.Allocate_Unique(lockname => lkname,
1084: lockhandle => lkhandle,
1085: expiration_secs => exp_secs);
1086:
1087: -- request the lock in a loop. If timeout and X_Keep_Looping is TRUE,
1092: (trial_num <= X_Max_Trys))
1093: LOOP
1094:
1095: -- Try to obtain the lock with max. wait time of 2 minutes
1096: lkresult := DBMS_LOCK.Request(lockhandle => lkhandle,
1097: lockmode => X_Lock_Mode,
1098: timeout => waittime);
1099:
1100: IF ((lkresult = 0) OR (lkresult = 4)) THEN
1113: v1 => lkname,
1114: t2 => 'SLEEP_TIME',
1115: v2 => TO_CHAR(sleep_time/60));
1116:
1117: DBMS_LOCK.Sleep(seconds => sleep_time);
1118:
1119: ELSE
1120: -- Either encounter deadlock, parameter error or illegal lock handle.
1121: -- Print out appropriate message and error out
1220: t2 => 'ACTION',
1221: v2 => lkname);
1222: END IF;
1223: -- get Oracle-assigned lock handle
1224: DBMS_LOCK.Allocate_Unique(lockname => lkname,
1225: lockhandle => lkhandle,
1226: expiration_secs => exp_secs);
1227:
1228: -- release the user named lock
1225: lockhandle => lkhandle,
1226: expiration_secs => exp_secs);
1227:
1228: -- release the user named lock
1229: lkresult := DBMS_LOCK.Release(lockhandle => lkhandle);
1230:
1231: IF (lkresult = 0) THEN
1232: GL_MESSAGE.Func_Succ(func_name => 'GL_FLATTEN_SETUP_DATA.Release_Lock');
1233: