Problem viewing all_tab_columns from a package
500314Apr 20 2006 — edited Apr 20 2006I have a cursor within a package that refers to all_tab_columns. When I run the select in SQL Plus I get the desired results. However when I run it as part of the package it returns no rows. The select is:
SELECT atc1.column_name column_name
FROM all_tab_columns atc1, all_tab_columns atc2
WHERE atc1.owner = SCHEMA1
AND atc2.owner = SCHEMA2
AND atc1.table_name = atc2.table_name
AND atc1.table_name = TABLE_NAME
AND atc1.column_name = atc2.column_name;
The idea of the select is to identify all the columns for a table that are the same on two different schemas.
I have managed to narrow it down to the fact that the package does not see the same all_tab_columns as SQL Plus, ie it cannot see other schemas tables. Is there a grant that I need to do to ensure that the package can see all the other schemas? Or is there another way that I can do this?
Many thanks.