Click to See Complete Forum and Search --> : Materialized view source columns


beroetz
04-21-2006, 11:07 AM
Hi to all.
How can I extract the all source columns of a mview? In the user_mview_keys are presented only the single source columns, but not those who are included in expression. For example:
CREATE MATERIALIZED VIEW mview1 AS
SELECT emp_no, d.dname||e.ename FROM dept d INNER JOIN emp e ON (d.deptno=e.deptno)
So, in this case, in the user_mview_keys we can see only the emp_no field but not the dname and ename fields. Is there a way to extract this information from Oracle data dictionary without parsing the materialized view query? Also, is there a way to extract all columns that are included in the WHERE clause of the materialized view query?
Any help will be appreciate!

graham_o
04-21-2006, 01:04 PM
Maybe I'm reading this wrong but if you're just after the column names can't you just select them from user_tab_columns?

e.g.create materialized view testcols as select siteref||sitename from fig.t_jacsite;

17:02:47 jack@JACL> select column_name from user_tab_columns where table_name = 'TESTCOLS';

COLUMN_NAME
------------------------------
SITEREF||SITENAME

beroetz
04-25-2006, 05:14 AM
But if you type:
Beroetz>CREATE MATERIALIZED VIEW TestCols AS
SELECT SITEREF||SITENAME "Col1" ...
Then we have:
Beroetz> select column_name from user_tab_columns where table_name = 'TESTCOLS';
COLUMN_NAME
------------------
Col1
So we loose the information about the source columns. Also I'm looking for the columns that participate in the WHERE clause!