DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Cursor - select table from different schema

  1. #1
    Join Date
    Sep 2000
    Posts
    11

    Question

    I am trying to compile a procedure in which I have a cursor that selects from a table in a different schema but it is not compiling.

    I am logged in as aaa.

    Here is the procedure:

    CREATE OR REPLACE PROCEDURE test
    AS
    CURSOR cur_test IS
    SELECT * FROM test_table /*test_table is in schema bbb*/;
    BEGIN
    NULL;
    END;

    I get the following error message:
    PLS-00201: identifier 'BBB.TEST_TABLE must be declared.

    I have a public synonym for test_table and I have tried qualifying the table with the owner and I get the same error message. It obviously knows which table I am trying to query but it won't let me compile the procedure.

    Any ideas?

  2. #2
    Join Date
    Jul 2000
    Posts
    296
    Did you grant select privileges on the table to user AAA or to a role of user AAA? Roles are disabled in stored procedures.
    Grant select on test_table to AAA.

  3. #3
    Join Date
    Sep 2000
    Posts
    11
    Thanks, you were exactly right!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width