Oracle 23.26SQLLab-verified · 2026-11-29

ORA-01733: virtual column not allowed here

The view column you are writing to is an expression, not a real table column.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-01733: virtual column not allowed here

Jump to a cause

  1. 01UPDATE of a calculated column (price * qty) in a view
  2. 02INSERT into a view that lists the calculated column
  3. 03UPDATE of a TO_CHAR date column in a view

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-29 · container image gvenzl/oracle-free:23-slim

A view column defined by an expression, such as price * qty AS amount or TO_CHAR(order_date, 'YYYY-MM-DD') AS order_date, has no single table column behind it. Oracle cannot write a value into it, so UPDATE or INSERT that names that column fails with ORA-01733. The asterisk under the statement points at the column.

user_updatable_columns shows which view columns can be written (UPDATABLE = YES/NO). Update the base columns instead, leave the expression out of INSERT, or add an INSTEAD OF trigger that translates the value. The three runs below show each.

01UPDATE of a calculated column (price * qty) in a view

order_lines_v had price * qty AS amount. UPDATE order_lines_v SET amount = 2400 WHERE id = 1 failed with ORA-01733.

user_updatable_columns showed AMOUNT NO and ID, PRICE, QTY YES. Updating the real column, SET price = 1200, worked, and amount became 2400 (1200 × 2) by itself.

Setup
Setuprun as lab_a
CREATE TABLE order_lines (id NUMBER PRIMARY KEY, price NUMBER, qty NUMBER);
INSERT INTO order_lines VALUES (1, 1000, 2);
INSERT INTO order_lines VALUES (2, 500, 3);
COMMIT;
CREATE VIEW order_lines_v AS SELECT id, price, qty, price * qty AS amount FROM order_lines;
OUTPUT
Table created.


1 row created.


1 row created.


Commit complete.


View created.
Reproducerun as lab_a
UPDATE order_lines_v SET amount = 2400 WHERE id = 1;
✕ ERROR
UPDATE order_lines_v SET amount = 2400 WHERE id = 1
                         *
ERROR at line 1:
ORA-01733: virtual column not allowed here
Help: https://docs.oracle.com/error-help/db/ora-01733/
Checkrun as lab_a
COLUMN column_name FORMAT A12
SELECT column_name, updatable FROM user_updatable_columns WHERE table_name = 'ORDER_LINES_V' ORDER BY column_name;
OUTPUT
COLUMN_NAME  UPD
------------ ---
AMOUNT       NO
ID           YES
PRICE        YES
QTY          YES

4 rows selected.
After the fixrun as lab_a
UPDATE order_lines_v SET price = 1200 WHERE id = 1;
SELECT id, price, qty, amount FROM order_lines_v ORDER BY id;
✓ SUCCESS
1 row updated.


        ID      PRICE        QTY     AMOUNT
---------- ---------- ---------- ----------
         1       1200          2       2400
         2        500          3       1500

2 rows selected.

02INSERT into a view that lists the calculated column

INSERT INTO order_lines_v (id, price, qty, amount) VALUES (3, 700, 2, 1400) failed with ORA-01733 at amount.

user_updatable_columns again showed AMOUNT NO. Leaving amount out, INSERT INTO order_lines_v (id, price, qty) VALUES (3, 700, 2), created the row, and the view showed amount 1400.

Setup
Setuprun as lab_a
CREATE TABLE order_lines (id NUMBER PRIMARY KEY, price NUMBER, qty NUMBER);
CREATE VIEW order_lines_v AS SELECT id, price, qty, price * qty AS amount FROM order_lines;
OUTPUT
Table created.


View created.
Reproducerun as lab_a
INSERT INTO order_lines_v (id, price, qty, amount) VALUES (3, 700, 2, 1400);
✕ ERROR
INSERT INTO order_lines_v (id, price, qty, amount) VALUES (3, 700, 2, 1400)
                                           *
ERROR at line 1:
ORA-01733: virtual column not allowed here
Help: https://docs.oracle.com/error-help/db/ora-01733/
Checkrun as lab_a
COLUMN column_name FORMAT A12
SELECT column_name, updatable FROM user_updatable_columns WHERE table_name = 'ORDER_LINES_V' ORDER BY column_name;
OUTPUT
COLUMN_NAME  UPD
------------ ---
AMOUNT       NO
ID           YES
PRICE        YES
QTY          YES

4 rows selected.
After the fixrun as lab_a
INSERT INTO order_lines_v (id, price, qty) VALUES (3, 700, 2);
SELECT id, price, qty, amount FROM order_lines_v;
✓ SUCCESS
1 row created.


        ID      PRICE        QTY     AMOUNT
---------- ---------- ---------- ----------
         3        700          2       1400

1 row selected.

03UPDATE of a TO_CHAR date column in a view

orders_v showed the date as text with TO_CHAR(order_date, 'YYYY-MM-DD') AS order_date. A screen that saves through the view ran UPDATE orders_v SET order_date = '2024-03-01' and got ORA-01733.

When the application must keep writing to the view, an INSTEAD OF UPDATE trigger can turn the text back into a date: UPDATE orders SET order_date = TO_DATE(:NEW.order_date, 'YYYY-MM-DD') WHERE id = :OLD.id. After creating it, the same UPDATE succeeded and the view showed 2024-03-01.

Setup
Setuprun as lab_a
CREATE TABLE orders (id NUMBER PRIMARY KEY, order_date DATE);
INSERT INTO orders VALUES (1, DATE '2024-01-05');
COMMIT;
CREATE VIEW orders_v AS SELECT id, TO_CHAR(order_date, 'YYYY-MM-DD') AS order_date FROM orders;
OUTPUT
Table created.


1 row created.


Commit complete.


View created.
Reproducerun as lab_a
UPDATE orders_v SET order_date = '2024-03-01' WHERE id = 1;
✕ ERROR
UPDATE orders_v SET order_date = '2024-03-01' WHERE id = 1
                    *
ERROR at line 1:
ORA-01733: virtual column not allowed here
Help: https://docs.oracle.com/error-help/db/ora-01733/
Fixrun as lab_a
CREATE OR REPLACE TRIGGER orders_v_iou INSTEAD OF UPDATE ON orders_v FOR EACH ROW
BEGIN
  UPDATE orders SET order_date = TO_DATE(:NEW.order_date, 'YYYY-MM-DD') WHERE id = :OLD.id;
END;
/
OUTPUT
Trigger created.
After the fixrun as lab_a
UPDATE orders_v SET order_date = '2024-03-01' WHERE id = 1;
SELECT id, order_date FROM orders_v;
✓ SUCCESS
1 row updated.


        ID ORDER_DATE
---------- ----------
         1 2024-03-01

1 row selected.

FAQ

How do I see which view columns can be updated?

SELECT column_name, updatable FROM user_updatable_columns WHERE table_name = 'VIEW_NAME'; NO means it is an expression column.

How do I update a calculated column in a view?

Update the base columns the expression uses. In the run above, changing price updated amount automatically.

Can I INSERT into a view that has an expression column?

Yes, as long as the INSERT column list leaves that column out.

How do I make a view with TO_CHAR updatable?

Create an INSTEAD OF UPDATE trigger on the view that converts the value back (TO_DATE) and updates the base table.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0