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
With CREATE TABLE ... AS SELECT (CTAS), each new column takes its data type and length from the SELECT expression. A bare NULL has no type or length, so Oracle stops with ORA-01723 and points the asterisk at that column.
This usually happens when you add an empty placeholder column to a copy of a table, such as a note or memo column to fill in later. In Oracle an empty string '' is also NULL, so '' AS memo fails the same way.
Both runs were fixed by giving the column an explicit type with CAST(NULL AS VARCHAR2(n)). The new table then had the column with that type and length.
01NULL AS column in CREATE TABLE AS SELECT
CREATE TABLE orders_review AS SELECT order_id, amount, NULL AS review_note FROM orders failed with ORA-01723, and the asterisk pointed at NULL.
SELECT DUMP(NULL) FROM dual returned just NULL — there is no type to copy. With CAST(NULL AS VARCHAR2(200)) AS review_note the table was created, and user_tab_columns showed REVIEW_NOTE as VARCHAR2 with length 200.
Setup
CREATE TABLE orders (order_id NUMBER PRIMARY KEY, amount NUMBER);
INSERT INTO orders VALUES (1, 100);
INSERT INTO orders VALUES (2, 250);
COMMIT;Table created.
1 row created.
1 row created.
Commit complete.CREATE TABLE orders_review AS
SELECT order_id, amount, NULL AS review_note FROM orders;SELECT order_id, amount, NULL AS review_note FROM orders
*
ERROR at line 2:
ORA-01723: zero-length columns are not allowed
Help: https://docs.oracle.com/error-help/db/ora-01723/SELECT DUMP(NULL) AS null_dump FROM dual;NULL
----
NULL
1 row selected.CREATE TABLE orders_review AS
SELECT order_id, amount, CAST(NULL AS VARCHAR2(200)) AS review_note FROM orders;
COLUMN column_name FORMAT A12
COLUMN data_type FORMAT A10
SELECT column_name, data_type, data_length FROM user_tab_columns WHERE table_name = 'ORDERS_REVIEW' ORDER BY column_id;Table created.
COLUMN_NAME DATA_TYPE DATA_LENGTH
------------ ---------- -----------
ORDER_ID NUMBER 22
AMOUNT NUMBER 22
REVIEW_NOTE VARCHAR2 200
3 rows selected.02'' AS column (an empty string is NULL in Oracle)
SELECT customer_id, name, '' AS memo FROM customers inside CTAS also failed with ORA-01723.
CASE WHEN '' IS NULL returned 'empty string is NULL', so '' is the same as NULL here. With CAST(NULL AS VARCHAR2(100)) AS memo the table was created, with MEMO as VARCHAR2(100).
Setup
CREATE TABLE customers (customer_id NUMBER PRIMARY KEY, name VARCHAR2(50));
INSERT INTO customers VALUES (1, 'Kim');
COMMIT;Table created.
1 row created.
Commit complete.CREATE TABLE customers_tmp AS
SELECT customer_id, name, '' AS memo FROM customers;SELECT customer_id, name, '' AS memo FROM customers
*
ERROR at line 2:
ORA-01723: zero-length columns are not allowed
Help: https://docs.oracle.com/error-help/db/ora-01723/SELECT CASE WHEN '' IS NULL THEN 'empty string is NULL' END AS check_result FROM dual;CHECK_RESULT
--------------------
empty string is NULL
1 row selected.CREATE TABLE customers_tmp AS
SELECT customer_id, name, CAST(NULL AS VARCHAR2(100)) AS memo FROM customers;
COLUMN column_name FORMAT A12
COLUMN data_type FORMAT A10
SELECT column_name, data_type, data_length FROM user_tab_columns WHERE table_name = 'CUSTOMERS_TMP' ORDER BY column_id;Table created.
COLUMN_NAME DATA_TYPE DATA_LENGTH
------------ ---------- -----------
CUSTOMER_ID NUMBER 22
NAME VARCHAR2 50
MEMO VARCHAR2 100
3 rows selected.FAQ
How do I fix ORA-01723 zero-length columns are not allowed?
Give the NULL column a type in the SELECT: CAST(NULL AS VARCHAR2(200)) AS review_note. Use the type and length you want in the new table.
Why does '' AS col also give ORA-01723?
In Oracle an empty string is NULL, as the '' IS NULL check showed. It has no type or length either.
Can I add a NUMBER or DATE column the same way?
The runs above used VARCHAR2. CAST takes the target type, so write the type you want for the new column.
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