If you use SQL*Plus
, it would be so easy to find and fix the error. And ideally I would expect ORA-00933: SQL command not properly ended
and not ORA-00905: missing keyword
.
For example,
SQL> SELECT COUNT(*) FROM emp e,
2 (SELECT * FROM emp
3 ) as "A" WHERE e.empno = A.empno
4 /
) as "A" WHERE e.empno = A.empno
*
ERROR at line 3:
ORA-00933: SQL command not properly ended
SQL>
The error stack clearly shows the error is at line 3 due to the incorrect syntax of the alias using keyword AS
.
Your modified create view would be -
CREATE OR REPLACE VIEW Tickets_RAFAL
AS
SELECT t.ticket_id,
t.subject,
t.descr description,
t.assigned_to,
t.created_on,
t.created_by,
t.closed_on,
td.number_of_details
FROM tickets t
JOIN
(SELECT ticket_id,
COUNT(ticket_id) number_of_details
FROM Ticket_Details
GROUP BY ticket_id
) td
ON t.ticket_id=td.ticket_id
/