Oracle 11g Virtual Columns
Oracle 11g Virtual Columns
Oracle 11g Virtual Columns
á
What are virtual columns ?
If say, instead of average, only sum needs to be computed, you just need to alter the formula of the
view.
CREATE OR REPLACE VIEW virtual_need_view AS
SELECT col_1, col_2 , col_3 , (col_1 + col_2 + col_3 ) AS S _VAL E FRO virtual_need ;
ë In Oracle 11g, a table can contain a virtual column which derives the values by
evaluating expressions that might use:
ë Columns from the same table
ë Constants
ë Function calls (user-defined functions or SQL functions)
ë Based on the result of the expression, the datatype of the virtual column can
be decided
e.g.
2 COL_2 BER 22 O
3 COL_3 BER 22 "COL_1³ * "COL_2" YES
Populating virtual columns
ë Virtual columns can be used in the WHERE clause of PDATE and DELETE
statement but they can¶t be modified by DL.
ë You can OT explicitly write to a virtual column
Error report:
SQL Error: ORA-54013: ISERT operation disallowed on virtual columns
ë You need to specify column names to insert into a table having virtual columns.
ote :- The index created on virtual columns is always a function-based index. Oracle internally indexes
the expression associated with the value*
explain plan
for SELECT * FRO VIRT AL_COL _TABLE where col_3 = 200;