Reputation: 1127
My oracle database has a user (Lets say SWEET). Inside SWEET schema, i have a table called AUTO_PARTS.
Now, i created a new user (SWEET_CV) and created a view on SWEET's AUTO_PARTS table.
CREATE SCHEMA AUTHORIZATION SWEET_CV
CREATE VIEW SWEET_CV.new_autoparts_view
AS SELECT * FROM SWIFT.AUTO_PARTS WHERE PRODUCTNAME = 'ABC'
GRANT select ON SWEET_CV.new_autoparts_view TO SWEET;
The last Grant statement gave error ORA-01720: grant option does not exist for 'SWEET.AUTO_PARTS'. So i did the below.
From SWEET account:
GRANT SELECT ON AUTO_PARTS TO SWEET_CV *WITH GRANT OPTION*
And then From SWEET_CV account:
GRANT SELECT ON SWEET_CV.new_autoparts_view TO SWEET;
Both the grants succeeded and i committed.
Now, when i login to SWEET and query 'select * from SWEET_CV.new_autoparts_view', rows are returned. But when i query 'select * from new_autoparts_view' it says table or view does not exist. Can you please explain why it says not exist even after i did GRANT.
I want to access the new schema's view in my SWEET without having to refer it as newschema(dot)viewname
Thanks in advance
Upvotes: 2
Views: 43305
Reputation:
I want to access the new schema's view in my SWEET without having to refer it as
You need to create a synonym in the SWEET
schema that references the view:
create synonym sweet.new_autoparts_view for sweet_cv.new_autoparts_view;
Upvotes: 4