ORA-01031: insufficient privileges [message #614202] |
Mon, 19 May 2014 01:09 |
|
Hi All
I have created a package to return date range. Code of package body is as below:
create or replace package body gen_date_dim
is
function month_range( range_from date, range_to date) return date_tab
is
p_date_tab date_tab;
begin
select add_months(range_from, level-1)
bulk collect into p_date_tab
from dual
connect by level <= months_between(range_to,range_from);
return p_date_tab;
end month_range;
end gen_date_dim;
I created by the required TYPE also
create type date_tab is table of date
Now I want to create following view based on this package and type. The target view, package and TYPE are in same schema. But it is showing the error Insufficient privileges. How can I resolve this?
create or replace force view dwh.v_dim_date
as
select column_value period_sid,
to_char(column_value,'YYYYMM') month_code,
to_char(column_value,'Mon YYYY') month_name,
'QTR'||to_char(column_value,'Q YYYY') quarter_name
from table(dwh.gen_date_dim.month_Range(to_date('01-jan-1900','dd-mon-yyyy'),to_date('01-dec-2100','dd-mon-yyyy')))
If I run the select statement separately, it can fetch the records:
select column_value period_sid,
to_char(column_value,'YYYYMM') month_code,
to_char(column_value,'Mon YYYY') month_name,
'QTR'||to_char(column_value,'Q YYYY') quarter_name
from table(dwh.gen_date_dim.month_Range(to_date('01-jan-1900','dd-mon-yyyy'),to_date('01-dec-2100','dd-mon-yyyy')))
|
|
|
|
|
Re: ORA-01031: insufficient privileges [message #614208 is a reply to message #614206] |
Mon, 19 May 2014 02:07 |
|
Littlefoot
Messages: 21807 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Why did you grant DBA? Generally speaking, when you create a user, you should grant only minimal set of privileges. As it seems that you don't rally know which privileges are contained within precreated roles (such as DBA), pay attention to what you do - granting too much power can be dangerous. In your example, I don't see any reason why should that user be granted DBA (but I might be wrong).
|
|
|