1: function apm_upgrade_order(
2: v_path in varchar
3: )
4: return char
5: is
6: a_pos1 integer;
7: a_pos2 integer;
8: a_path varchar(4000);
9: begin
10: -- Set a_path to the tail of the path (the file name).
11: a_path := substr(v_path, instr(v_path, '/', -1) + 1);
12:
13: -- Figure out the from/to version numbers for the individual file.
14: a_pos1 := instr(a_path, '-', -1, 2);
15: a_pos2 := instr(a_path, '-', -1);
16: if a_pos1 = 0 or a_pos2 = 0 then
17: -- There aren't two hyphens in the file name. Just return the path.
18: return a_path;
19: end if;
20:
21: -- Return the root path, plus two dashes, plus the version order string for the
22: -- from version of the upgrade script.
23: return substr(a_path, 1, a_pos1 - 1) || '--' ||
24: apm_version_order(substr(a_path, a_pos1 + 1, a_pos2 - a_pos1 - 1));
25: end;
|