Accessing a function against another owner in oracle? -


i having function called fn_export , owner bhist. calling function ohist user using bhist.fn_export. while calling facing below issue.

ora-00942: table or view not exist ora-06512: @ "bhist.fn_export", line 442 ora-06512: @ line 20 

i tried verify tables in function , able access tables ohist. have execute grant on bhist.fn_export ohist. still having issue. can 1 of please in resolving issue?

thanks, venkat

you need grant execute privilege on function ohist user.
syntax is:

grant execute on function_name username; 

you can connect bhist user , grant privilege using:

grant execute on fn_export ohist; 

you can connect sys or system, , use command:

grant execute on bhist.fn_export ohist; 

see below simple example (one user named test , other named dev):

sql> connect test enter password: connected. sql> create function fn_export return number   2  begin   3    return 20;   4  end;   5  /  function created.  sql> connect dev enter password: connected. sql> select test.fn_export dual; select test.fn_export dual        * error @ line 1: ora-00904: "test"."fn_export": invalid identifier   sql> connect test enter password: connected. sql> grant execute on fn_export dev;  grant succeeded.  sql> connect dev enter password: connected. sql> select test.fn_export dual;   fn_export ----------         20  sql> 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -