Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check column is virtual in Oracle?

Tags:

sql

oracle

How to check if a column is virtual in Oracle?

like image 375
Alex Yeung Avatar asked Nov 10 '11 04:11

Alex Yeung


People also ask

How do I find virtual columns?

A virtual column is a table column whose values are calculated automatically using other column values, or another deterministic expression. In this syntax: First, specify the name ( column_name ) of the virtual column. Second, specify the virtual column's data type.

What is virtual column in Oracle with example?

Virtual columns are columns in Oracle tables whose content is based on a formula or expression that makes use of data from other columns. They should be understood almost as one more column in the table, and can be used as part of the indexing of the table, as foreign keys in another table, include comments, etc.

What is virtual column in the table?

In relational databases a virtual column is a table column whose value is automatically computed using other columns values, or another deterministic expression.

Can we update virtual column in Oracle?

The values of the virtual column are not stored in the database. Rather, it's computed at run-time when you query the data. You can't update (in SET clause of update statement) the values of virtual column.


1 Answers

You can use the VIRTUAL_COLUMN column of USER_TAB_COLS (or ALL_TAB_COLS or DBA_TAB_COLS depending on what privileges you have and what user owns the table in question.

SELECT virtual_column
  FROM all_tab_cols
 WHERE owner = <<owner of the table>>
   AND table_name = <<name of table>>
   AND column_name = <<name of column>>
like image 98
Justin Cave Avatar answered Oct 24 '22 06:10

Justin Cave