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
ORA-03050 is a newer syntax error that names the reserved word Oracle refused: "COMMENT" is a reserved word. On older versions, mistakes like these were usually reported as ORA-01747 (invalid user.table.column, table.column, or column specification) without naming the word. All three cases below were run on Oracle 26ai Free.
The word in quotes is not always your column name. In dynamic SQL it can be WHERE, which means something before it is missing.
01Reserved word as a column name in CREATE TABLE (comment, date)
CREATE TABLE notice with columns comment and date failed on comment, the first one Oracle reached.
V$RESERVED_WORDS showed why: DATE has RESERVED = Y, and COMMENT has RES_SEMI = Y (semi-reserved). Both are rejected as plain column names. Renaming them to remark and notice_dt let the table be created, and the INSERT and SELECT worked.
CREATE TABLE notice (
id NUMBER PRIMARY KEY,
title VARCHAR2(100),
comment VARCHAR2(200),
date DATE
); comment VARCHAR2(200),
*
ERROR at line 4:
ORA-03050: invalid identifier: "COMMENT" is a reserved word
Help: https://docs.oracle.com/error-help/db/ora-03050/COLUMN keyword FORMAT A10
SELECT keyword, reserved, res_semi FROM v$reserved_words WHERE keyword IN ('COMMENT', 'DATE', 'REMARK') ORDER BY keyword;KEYWORD R R
---------- - -
COMMENT N Y
DATE Y N
2 rows selected.Check a name with SELECT keyword, reserved, res_semi FROM v$reserved_words WHERE keyword = '...'. No row means it is not a reserved word (REMARK returned no row).
CREATE TABLE notice (
id NUMBER PRIMARY KEY,
title VARCHAR2(100),
remark VARCHAR2(200),
notice_dt DATE
);
INSERT INTO notice VALUES (1, 'Maintenance', 'Sunday 02:00', DATE '2026-12-06');
COLUMN remark FORMAT A20
SELECT id, remark, TO_CHAR(notice_dt, 'YYYY-MM-DD') AS notice_dt FROM notice;Table created.
1 row created.
ID REMARK NOTICE_DT
---------- -------------------- ----------
1 Sunday 02:00 2026-12-06
1 row selected.02Column created as "SIZE" but queried without quotes
The table was created with "SIZE" in double quotes, which works. But SELECT i.size without quotes failed with ORA-03050 on "SIZE".
USER_TAB_COLUMNS listed the column as SIZE. Writing it with quotes every time, i."SIZE", returned the row (T-shirt, L).
Setup
CREATE TABLE items (id NUMBER PRIMARY KEY, name VARCHAR2(50), "SIZE" VARCHAR2(10));
INSERT INTO items VALUES (1, 'T-shirt', 'L');
COMMIT;Table created.
1 row created.
Commit complete.SELECT i.id, i.name, i.size FROM items i;SELECT i.id, i.name, i.size FROM items i
*
ERROR at line 1:
ORA-03050: invalid identifier: "SIZE" is a reserved word
Help: https://docs.oracle.com/error-help/db/ora-03050/SELECT column_name FROM user_tab_columns WHERE table_name = 'ITEMS' ORDER BY column_id;COLUMN_NAME
------------------------------
ID
NAME
SIZE
3 rows selected.Quoted reserved-word columns must be quoted in every query, in upper case. Renaming the column avoids this for good.
SELECT i.id, i.name, i."SIZE" FROM items i; ID NAME SIZE
---------- ------------------------------ ----------
1 T-shirt L
1 row selected.03Dynamic UPDATE built with an empty SET list
The SET part came from a variable that stayed NULL, so the statement became UPDATE emp SET WHERE id = 1. Oracle then read WHERE as a column name and reported "WHERE" is a reserved word, with ORA-06512: at line 4 pointing to the EXECUTE IMMEDIATE.
Printing the statement with DBMS_OUTPUT showed the gap. Skipping the UPDATE when the SET list is NULL fixed it: the empty case printed no changes - UPDATE skipped, and with sal = 200 one row was updated.
Setup
CREATE TABLE emp (id NUMBER PRIMARY KEY, name VARCHAR2(20), sal NUMBER);
INSERT INTO emp VALUES (1, 'KIM', 100);
COMMIT;Table created.
1 row created.
Commit complete.DECLARE
v_set VARCHAR2(200); -- nothing changed on the screen, so no column was added
BEGIN
EXECUTE IMMEDIATE 'UPDATE emp SET ' || v_set || ' WHERE id = 1';
END;
/DECLARE
*
ERROR at line 1:
ORA-03050: invalid identifier: "WHERE" is a reserved word
ORA-06512: at line 4
Help: https://docs.oracle.com/error-help/db/ora-03050/SET SERVEROUTPUT ON
DECLARE
v_set VARCHAR2(200);
BEGIN
DBMS_OUTPUT.PUT_LINE('UPDATE emp SET ' || v_set || ' WHERE id = 1');
END;
/UPDATE emp SET WHERE id = 1
PL/SQL procedure successfully completed.SET SERVEROUTPUT ON
DECLARE
v_set VARCHAR2(200);
BEGIN
IF v_set IS NULL THEN
DBMS_OUTPUT.PUT_LINE('no changes - UPDATE skipped');
ELSE
EXECUTE IMMEDIATE 'UPDATE emp SET ' || v_set || ' WHERE id = 1';
END IF;
v_set := 'sal = 200';
IF v_set IS NOT NULL THEN
EXECUTE IMMEDIATE 'UPDATE emp SET ' || v_set || ' WHERE id = 1';
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' row updated');
END IF;
END;
/
SELECT id, name, sal FROM emp;no changes - UPDATE skipped
1 row updated
PL/SQL procedure successfully completed.
ID NAME SAL
---------- ------------------------------ ----------
1 KIM 200
1 row selected.FAQ
What replaced ORA-01747 in Oracle 23ai?
In this 26ai lab, a reserved word used as a column name gave ORA-03050, and a SET list ending in a comma gave ORA-03083. Both name the problem more directly than ORA-01747 did.
Can I use COMMENT or DATE as a column name in Oracle?
Not as a plain name. DATE is fully reserved and COMMENT is semi-reserved; both gave ORA-03050 in CREATE TABLE. Use names like remark and notice_dt.
How do I check if a word is reserved in Oracle?
Query V$RESERVED_WORDS (needs DBA-level access). Look at the RESERVED and RES_SEMI columns. If no row comes back, the word is not reserved.
Why does ORA-03050 say "WHERE" is a reserved word?
Something is missing before WHERE. In dynamic SQL this is often an empty SET list: UPDATE emp SET WHERE .... Print the final statement before running it.
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