1: function hp_onelevelup_content_node (filesystem_node IN integer)
2: return varchar2
3: IS
4: CURSOR parent_cursor IS
5: select parent_id from users_files
6: where file_id=filesystem_node;
7: CURSOR managed_p_cursor IS
8: select managed_p from users_files
9: where file_id=filesystem_node;
10: CURSOR directory_p_cursor IS
11: select directory_p from users_files
12: where file_id=filesystem_node;
13: managedp varchar(1);
14: dirp varchar(1);
15: parentid integer;
16: BEGIN
17: OPEN parent_cursor;
18: OPEN managed_p_cursor;
19: OPEN directory_p_cursor;
20: FETCH parent_cursor INTO parentid;
21: FETCH managed_p_cursor INTO managedp;
22: FETCH directory_p_cursor INTO dirp;
23: CLOSE parent_cursor;
24: CLOSE managed_p_cursor;
25: CLOSE directory_p_cursor;
26: IF parentid is null
27: THEN
28: return filesystem_node;
29: END IF;
30: IF managedp = 't'
31: THEN
32: IF dirp = 't'
33: THEN
34: return filesystem_node;
35: ELSE
36: return hp_onelevelup_content_node(parentid);
37: END IF;
38: ELSE
39: return filesystem_node;
40: END IF;
41: END;
|