Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Why won't DBA_CONSTRAINTS work whereas ALL_CONSTRAINTS will

614646Dec 21 2007 — edited Dec 21 2007
I have set up a database in oracle and given a user all the necessary privileges to create tables etc. Through Putty last night I created two columns, one called 'house' and the other called 'location', and filled it with the proper data. Once this was done I ran this to give me the constraints I had put on the table;

CODE

SELECT A.TABLE_NAME, A.COLUMN_NAME, A.CONSTRAINT_NAME, B.CONSTRAINT_TYPE, B.SEARCH_CONDITION
FROM DBA_CONS_COLUMNS A, DBA_CONSTRAINTS B
WHERE A.TABLE_NAME = 'HOUSE' AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME;


And it gave me back the proper result. I have since created more tables and altered them to take into account foreign keys. Now when I run this I get the following error;


CODE

SQL> SELECT A.TABLE_NAME, A.COLUMN_NAME, A.CONSTRAINT_NAME, B.CONSTRAINT_TYPE, B.SEARCH_CONDITION
FROM DBA_CONS_COLUMNS A, DBA_CONSTRAINTS B
WHERE A.TABLE_NAME = 'HOUSE' AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME; 2 3
FROM DBA_CONS_COLUMNS A, DBA_CONSTRAINTS B
*
ERROR at line 2:
ORA-00942: table or view does not exist


Where as if I run this below I get the same result as before;

CODE

SELECT A.TABLE_NAME, A.COLUMN_NAME, A.CONSTRAINT_NAME, B.CONSTRAINT_TYPE, B.SEARCH_CONDITION
FROM ALL_CONS_COLUMNS A, ALL_CONSTRAINTS B
WHERE A.TABLE_NAME = 'HOUSE' AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME;


Any ideas?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2008
Added on Dec 21 2007
5 comments
813 views