PL/SQL: ORA-01031: insufficient privileges
513417Oct 22 2008 — edited Oct 23 2008Hi Guys,
I am trying to create a package, inside that package create a function.
I am getting error - PL/SQL: ORA-01031: insufficient privileges.
I have done -
1. Conn system/system@mydb
2. Grant select on system.v_db_name to <user>
3. Conn <user>/<pwd>@mydb
4. Create or Replace Function get_db_name Return VARCHAR2 IS
v_db_name1 VARCHAR2(100):= NULL;
BEGIN
Select instance_name into v_db_name1
from system.v_db_name
where rownum<2;
IF Lower(v_db_name1) = 'vdev9i' THEN
v_db_name1 := 'vd';
ELSIF Lower(v_db_name1) = 'vcal9i' THEN
v_db_name1 := 'vc';
ELSIF Lower(v_db_name1) = 'vlive9i' THEN
v_db_name1 := 'vl';
END IF; RETURN v_db_name1;
END;
I understand that privileges have to be given directly and not through role.
That is what i have done in first step, but still this error persists.
Can anyone please help in this?
Thanks!
Av.