Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

oracle - SQL Error: ORA-00933: SQL command not properly ended

I am trying to update a record in oracle SQL developer by using Joins. Following is my query-

UPDATE system_info set field_value = 'NewValue' 
FROM system_users users 
JOIN system_info info ON users.role_type = info.field_desc 
where users.user_name = 'uname'

However, when I tried to execute it, I got following error-

Error report: SQL Error: ORA-00933: SQL command not properly ended 
              00933. 00000 - "SQL command not properly ended"

I tried removing JOINS

UPDATE system_info info 
SET info.field_value = 'NewValue' 
FROM system_users users 
where users.user_name = 'uname' AND users.role_type = info.field_desc

but still having same error can anybody tell me the error reason and solution

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Semicolon ; on the end of command had caused the same error on me.

cmd.CommandText = "INSERT INTO U_USERS_TABLE (USERNAME, PASSWORD, FIRSTNAME, LASTNAME) VALUES ("
                + "'" + txtUsername.Text + "',"
                + "'" + txtPassword.Text + "',"
                + "'" + txtFirstname.Text + "',"
                + "'" + txtLastname.Text + "');"; <== Semicolon in "" is the cause.
                                                      Removing it will be fine.

Hope it helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...