Question: on ORA-00933: SQL command not properly
ended
CODE
|
UPDATE PEOPLE
SET PEOPLE.SURNAME =
HR_DATA_IMPORT.SURNAME
INNER JOIN PEOPLE ON
HR_DATA_IMPORT.NI.NO = PEOPLE.NI_NUMBER;
ORA-00933: SQL command not properly
ended |
ORA-00933: SQL command not properly ended
Cause: The SQL statement ends with
an inappropriate clause. For example, an ORDER BY
clause may have been included in a CREATE VIEW or
INSERT statement. ORDER BY cannot be used to create
an ordered view or to insert in a certain order.
Action: Correct the syntax by
removing the inappropriate clauses. It may be
possible to duplicate the removed clause with
another SQL statement. For example, to order the
rows of a view, do so when querying the view and not
when creating it. This error can also occur in
SQL*Forms applications if a continuation line is
indented. Check for indented lines and delete these
spaces.
Answer by Chenn:
I am never able to run an update using a join. You
need a subselect. Filter it by pushing your field
from the main query into the subselect. I'm not sure
what your NI.No field is so you may need to take a
look at that...
UPDATE PEOPLE a
SET a.SURNAME = (
select b.SURNAME
from PEOPLE b
where b.NI.NO = a.NI_NUMBER
)

This is the BC Oracle DBA Scripts collection with Oracle DBA Scripts for tuning, monitoring, a professional download of over 600 Oracle DBA Scripts.
 |
|
|
Get the Complete
Oracle SQL Tuning Information
The landmark book
"Advanced Oracle
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
buy it
for 30% off directly from the publisher.
|
|