Adding a Virtual Column

A virtual column is a column that refers to other columns in the table.


CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL,
                  ENAME VARCHAR2(10),
                  JOB VARCHAR2(9),
                  SAL NUMBER(7, 2),
                  DEPTNO NUMBER(2));
                  
ALTER TABLE emp
ADD (double_sal AS sal + sal);

DESCRIBE emp

INSERT INTO EMP VALUES (1, 'SMITH', 'CLERK',     800,    20);

SELECT * FROM emp;
Home »
Oracle »
Table » 

Column:
  1. Adding a Column
  2. Adding a Virtual Column
  3. Changing the Size of a Column
  4. Changing the Precision of a Numeric Column
  5. Changing the Data Type of a Column
  6. Changing the Default Value of a Column
  7. Dropping a Column
Related: