ORA-03048: SQL reserved word is not syntactically valid following ...
ORA-03048: SQL reserved word 'AS' is not syntactically valid following '...e.name, e.salary FROM emp 'A reserved word or symbol appears where the grammar does not allow it.
Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-13
ORA-03048 is a syntax error introduced in Oracle 23ai. It names the reserved word or symbol that cannot appear at that point, and quotes the text just before it. Older versions usually reported these mistakes as ORA-00933 (SQL command not properly ended).
The quoted text ends exactly where the problem starts, so look at the boundary between the quote and the named word.
Causes and fixes
1AS before a table alias (FROM emp AS e)
MySQL, PostgreSQL and SQL Server accept FROM emp AS e. Oracle accepts AS only for column aliases, so AS after FROM emp is rejected.
Remove AS and write FROM emp e. The query returned Kim and Lee. Column aliases with AS, like name AS emp_name, kept working.
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, name VARCHAR2(20), dept_id NUMBER, salary NUMBER);
INSERT INTO emp VALUES (1, 'Kim', 10, 5000);
INSERT INTO emp VALUES (2, 'Lee', 10, 4200);
INSERT INTO emp VALUES (3, 'Park', 20, 6100);
INSERT INTO emp VALUES (4, 'Choi', 20, 3900);
CREATE TABLE dept (dept_id NUMBER PRIMARY KEY, dept_name VARCHAR2(20), loc VARCHAR2(20));
INSERT INTO dept VALUES (10, 'Sales', 'SEOUL');
INSERT INTO dept VALUES (20, 'IT', 'BUSAN');
COMMIT;Table created.
1 row created.
1 row created.
1 row created.
1 row created.
Table created.
1 row created.
1 row created.
Commit complete.SELECT e.name, e.salary
FROM emp AS e
WHERE e.dept_id = 10; FROM emp AS e
*
ERROR at line 2:
ORA-03048: SQL reserved word 'AS' is not syntactically valid following '...e.name, e.salary
FROM emp '
Help: https://docs.oracle.com/error-help/db/ora-03048/SELECT name AS emp_name FROM emp WHERE emp_id = 1;EMP_NAME
--------------------
Kim
1 row selected.SELECT e.name, e.salary
FROM emp e
WHERE e.dept_id = 10;NAME SALARY
------------------------------ ----------
Kim 5000
Lee 4200
2 rows selected.2One closing parenthesis too many
The subquery IN (SELECT ... WHERE loc = 'SEOUL')) ends with two ) but only one ( was opened. The message names ')' after ...WHERE loc = 'SEOUL').
Remove the extra parenthesis. The query then returned the employees in the SEOUL department (Kim, Lee).
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, name VARCHAR2(20), dept_id NUMBER, salary NUMBER);
INSERT INTO emp VALUES (1, 'Kim', 10, 5000);
INSERT INTO emp VALUES (2, 'Lee', 10, 4200);
INSERT INTO emp VALUES (3, 'Park', 20, 6100);
INSERT INTO emp VALUES (4, 'Choi', 20, 3900);
CREATE TABLE dept (dept_id NUMBER PRIMARY KEY, dept_name VARCHAR2(20), loc VARCHAR2(20));
INSERT INTO dept VALUES (10, 'Sales', 'SEOUL');
INSERT INTO dept VALUES (20, 'IT', 'BUSAN');
COMMIT;Table created.
1 row created.
1 row created.
1 row created.
1 row created.
Table created.
1 row created.
1 row created.
Commit complete.SELECT name
FROM emp
WHERE dept_id IN (SELECT dept_id
FROM dept
WHERE loc = 'SEOUL')); WHERE loc = 'SEOUL'))
*
ERROR at line 5:
ORA-03048: SQL reserved word ')' is not syntactically valid following '...WHERE loc = 'SEOUL')'
Help: https://docs.oracle.com/error-help/db/ora-03048/SELECT dept_id FROM dept WHERE loc = 'SEOUL'; DEPT_ID
----------
10
1 row selected.SELECT name
FROM emp
WHERE dept_id IN (SELECT dept_id
FROM dept
WHERE loc = 'SEOUL');NAME
------------------------------
Kim
Lee
2 rows selected.3ORDER BY written twice
This happens when code appends ORDER BY to a query that already has one. A query block can have only one ORDER BY, so the second ORDER is rejected.
Merge them into one clause: ORDER BY dept_id, name. The rows came back sorted by department, then by name (Choi before Park in dept 20).
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, name VARCHAR2(20), dept_id NUMBER, salary NUMBER);
INSERT INTO emp VALUES (1, 'Kim', 10, 5000);
INSERT INTO emp VALUES (2, 'Lee', 10, 4200);
INSERT INTO emp VALUES (3, 'Park', 20, 6100);
INSERT INTO emp VALUES (4, 'Choi', 20, 3900);
CREATE TABLE dept (dept_id NUMBER PRIMARY KEY, dept_name VARCHAR2(20), loc VARCHAR2(20));
INSERT INTO dept VALUES (10, 'Sales', 'SEOUL');
INSERT INTO dept VALUES (20, 'IT', 'BUSAN');
COMMIT;Table created.
1 row created.
1 row created.
1 row created.
1 row created.
Table created.
1 row created.
1 row created.
Commit complete.SELECT dept_id, name
FROM emp
ORDER BY dept_id
ORDER BY name; ORDER BY name
*
ERROR at line 4:
ORA-03048: SQL reserved word 'ORDER' is not syntactically valid following '...FROM emp
ORDER BY dept_id
'
Help: https://docs.oracle.com/error-help/db/ora-03048/SELECT dept_id, name FROM emp ORDER BY dept_id; DEPT_ID NAME
---------- ------------------------------
10 Kim
10 Lee
20 Park
20 Choi
4 rows selected.SELECT dept_id, name
FROM emp
ORDER BY dept_id, name; DEPT_ID NAME
---------- ------------------------------
10 Kim
10 Lee
20 Choi
20 Park
4 rows selected.FAQ
Why can't I use AS for a table alias in Oracle?
Oracle's grammar allows AS only for column aliases. Write FROM emp e instead of FROM emp AS e. In this lab, name AS emp_name worked while FROM emp AS e gave ORA-03048.
Is ORA-03048 the same as ORA-00933?
They cover similar mistakes. In this 23ai lab, statements that used to be typical ORA-00933 examples gave ORA-03048 or ORA-03049 instead, with the offending word in the message.
How do I find the wrong parenthesis in a long query?
The message quotes the text right before the extra ). Count ( and ) from the start of that subquery; the named ) is the one without a partner.
Can I sort by two columns in Oracle?
Yes, with a single ORDER BY: ORDER BY dept_id, name. Writing ORDER BY twice gives ORA-03048.
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