1: function short_name_from_group_name2
2: (v_short_name IN user_groups.short_name%TYPE, v_identifier IN integer)
3: return varchar
4: IS
5: v_new_short_name user_groups.short_name%TYPE;
6:
7: cursor c1 is select short_name
8: from user_groups
9: where short_name=v_short_name || decode(v_identifier, 0, '', v_identifier);
10: BEGIN
11: OPEN c1;
12: FETCH c1 into v_new_short_name;
13:
14: if c1%NOTFOUND then
15: select v_short_name || decode(v_identifier, 0, '', v_identifier) into v_new_short_name from dual;
16: return v_new_short_name;
17: else
18: return short_name_from_group_name2(v_short_name, v_identifier+1);
19: end if;
20:
21: END short_name_from_group_name2;
|