Table virtual column
Oracle Database Basic Course
Created by :
Database, Oracle
course
Programming, Software and application
1739
2020-12-07 03:13:23
A virtual column is a table column whose values are calculated automatically using other column values, or another deterministic expression.
Here is the syntax of a virtual column:
column_name [data_type] [GENERATED ALWAYS] AS (expression) [VIRTUAL]
In this syntax:
- First, specify the name ( column_name) of the virtual column.
- Second, specify the virtual column’s data type. If you omit the data type, the virtual column will take the data type of the result of the expression.
- Third, specify an expression in parentheses after the AS keyword. The values of the virtual column will derive from the expression.
- Note that the GENERATED ALWAYS and VIRTUAL keywords are for clarity only.
This statement shows how to define a virtual column in the CREATE TABLE statement:
CREATE TABLE table_name ( ..., virtual_column_name AS (expression) );
And this statement illustrates how to add a virtual column to an existing table using the ALTER TABLE statement:
ALTER TABLE table_name ADD ( virtual_column_name AS (expression) );

- Database Overview
- What Is Oracle Database
- History of Oracle Database
- Why Oracle Database
- Features of Oracle Database
- Oracle Vs. SQL Server: Key Differences
- Oracle Vs. MySQL Server: Key Differences
- Oracle Vs. NoSQL
- Install Oracle Database Server
- Oracle Database Sample Schema
- Execute Sample Database
- Connect to SQL Developer and Other SQL Editor