Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to grant access to use tables of one schema in another schema

I have an schema [A], which has a package in which a function calls another schema's[B] table [tableB]. When I compiled the package I got the error, "table or view doesnt exit" I googled and found that the error is because my package is calling another schema's table. Later I found that I have to grant privilage in the called schema[B]. In Schema B's package I wrote the following code

procedure givePrivilege begin GRANT SELECT ON tableB TO A; end;

Im new to Oracle and Im struck.

like image 688
user1469630 Avatar asked Sep 17 '25 18:09

user1469630


1 Answers

Follow these steps:

1) Login to schema B
2) Run the statement GRANT SELECT ON tableB TO A;
3) In the package make sure the tableB is referenced as B.tableB
4) Compile the package.

like image 169
Chandu Avatar answered Sep 19 '25 08:09

Chandu