Why won't DBA_CONSTRAINTS work whereas ALL_CONSTRAINTS will
614646Dec 21 2007 — edited Dec 21 2007I 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?