Question

I have created synonyms for functions/proc/seq in userid YYY from user id XXX.

create SYNONYM my_seq FOR XXX.my_seq

When I try to use the seq in user YYY, I am getting following error :

ORA-00942: table or view does not exist

and with functions : ORA-00904: : invalid identifier

Please let me know where I am doing wrong.

Was it helpful?

Solution

I am going to demonstrate with a simple example. I have two schemas on one server. Schema1 and Schema2.

I logon to Schema1 and run the script below.

-- Create sequence 
create sequence originalSeq
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 10
cache 20;


GRANT SELECT ON originalSeq TO SCHEMA2;

Then I logon to Schema2 and run the following script.

    create or replace synonym pointertooriginalsreq
      for SCHEMA1.originalSeq;  

select pointertooriginalsreq.nextval from dual

this should work in all versions of Oracle 8.1.7 upwards. Please let me know if you're still facing a problem.

OTHER TIPS

You have to provide grants from XXX user:

GRANT SELECT ON my_seq TO YYY;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top