1: function hp_fs_node_from_rel_name (rootid IN integer, rel_name IN varchar2)
2: return integer
3: IS
4: slash_location integer;
5: nodeid integer;
6: BEGIN
7: IF rel_name is null
8: THEN
9: return rootid;
10: ELSE
11: slash_location := INSTR(rel_name,'/');
12: IF slash_location = 0
13: THEN
14: select file_id into nodeid
15: from users_files
16: where parent_id=rootid
17: and filename=rel_name;
18: return nodeid;
19: ELSIF slash_location = 1
20: THEN
21: return hp_fs_node_from_rel_name(rootid, SUBSTR(rel_name,2));
22: ELSE
23: select file_id into nodeid
24: from users_files
25: where parent_id=rootid
26: and filename=SUBSTR(rel_name,1,slash_location-1);
27: return hp_fs_node_from_rel_name(nodeid,SUBSTR(rel_name,slash_location));
28: END IF;
29: END IF;
30: END;
|