Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"ORA-00903: invalid table name" error while updating a record

Tags:

sql

oracle

I have this table called iowe. It has been created and exists in my database. This is how it looks like:

NAME           AMOUNT Serial Number
---------- ---------- -------------
Praveen         20500
Roshan           5000             2
Rohit            5000             3
Shashi           7500             4

When I try to update the Serial Number corresponding to the name Praveen, by inputting the command

update table iowe
set "Serial Number" = 1 where amount = 20500

or

update table iowe
set "Serial Number" = 1 where name = 'Praveen'

I get the following error: ORA-00903: invalid table name

Other commands execute fine on this table.

like image 695
Anonymous Person Avatar asked Apr 02 '13 14:04

Anonymous Person


People also ask

How do I fix an invalid table name in SQL?

Rewrite your SQL to include a valid table name. To be a valid table name the following criteria must be met: The table name must begin with a letter. The table name can not be longer than 30 characters.


2 Answers

Remove the word "table" from your update statement:

update iowe
set "Serial Number" = 1 
where name = 'Praveen'
like image 50
sgeddes Avatar answered Nov 15 '22 21:11

sgeddes


You don't need the keyword table in an update statement:

update iowe
set "Serial Number" = 1
where amount = 20500

As you have it, it's looking for a table called 'table', while giving it the alias 'iowe'.

Not relevant to the question, but I would also really advise not giving objects mixed-case or non-standard names, since you have to quote them - as you are with "Serial Number". I have yet to see a case where the added complication and opportunities for confusion can be justified.

like image 28
Alex Poole Avatar answered Nov 15 '22 22:11

Alex Poole