Oracle Virtual Column
Oracle Virtual Column is a SQL data type in the Oracle Specific category. Oracle 11g+: virtual columns computed from expressions. Not stored (like MySQL VIRTUAL generated columns). The syntax is col TYPE GENERATED ALWAYS AS (expression) VIRTUAL. It returns virtual column. A typical example: CREATE TABLE employees ( first_name VARCHAR2(50), last_name VARCHAR2(50), full_name VARCHAR2(101) GENERATED ALWAYS AS (first_name || ' ' || last_name) VIRTUAL, salary NUMBER(10,2), bonus NUMBER(10,2), total_comp GENERATED ALWAYS AS (salary + NVL(bonus, 0)) VIRTUAL ); INSERT INTO employees (first_name, last_name, salary, bonus) VALUES ('Alice', 'Smith', 75000, 5000); SELECT full_name, total_comp FROM employees; -- full_name: Alice Smith -- total_comp: 80000 -- Virtual columns can be indexed: CREATE INDEX idx_full_name ON employees (full_name); A close relative is SEQUENCE (Oracle), which oracle: generates sequential numbers. Independent of tables. Accessed via NEXTVAL and CURRVAL. A close relative is ROWNUM / FETCH FIRST, which oracle: ROWNUM assigns sequential numbers to rows. Used for limiting results (pre-12c).