3

I would like to find computed column list in oracle database using Oracle Data Dictionary Views.

I would like to add more information. Suppose I have following computed/calculated column in database.

ALTER TABLE HR.EMPLOYEES
 ADD FULL_NAME AS ( FIRST_NAME || ' ' || LAST_NAME);

I can select this column value in Select Statements.

SELECT EMPLOYEE_ID,FULL_NAME FROM HR.EMPLOYEES;

Results

... 174 Ellen Abel ...

I can see this column in TAB_COLUMNS view.

 select * from all_tab_columns C 
 WHERE
 1 = 1
 AND C.table_name = 'EMPLOYEES'
 AND C.OWNER = 'HR'
 AND COLUMN_NAME = 'FULL_NAME'
 ;

I would like to find given schema, table and column find that if this column is calculated/computed?

Wrongly I thought that INDEXES view gives me this information. But following select returns no rows. This gives only functional indexes.

SELECT index_name,index_Type,I.*
FROM ALL_indexes I
WHERE 
1 = 1
AND INDEX_TYPE LIKE 'FUNCTION-BASED%'
AND I.OWNER = 'HR'
asked Jul 11, 2012 at 11:51

1 Answer 1

3

The column USER_TAB_COLS.virtual_column = 'YES' indicates if it's a virtual column.

You can get the expressions for each column with:

SELECT * 
FROM user_tab_columns
WHERE data_default IS NOT NULL;
answered Jul 11, 2012 at 12:42
1
  • 1
    Thank you. It seems that there is difference between ALL_TAB_COLS and ALL_TAB_COLUMNS as stated here (kr.forums.oracle.com/forums/thread.jspa?threadID=1123911). ALL_TAB_COLS view differs from "ALL_TAB_COLUMNS" in that hidden columns are not filtered out." Commented Jul 11, 2012 at 13:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.