[Tutor] updating Oracle tables via python

ralf.steckel at online.ms ralf.steckel at online.ms
Fri Apr 1 10:30:31 CEST 2005


Hi all,

1) this are the *correct* quotation marks:

strUpdate = " UPDATE table SET firstname = 'JOSEPH'  WHERE lastname = 'SMITH' "

because SQL uses single quotation marks for character strings in column values.
Double quotation marks are used to quote a column name when the column name
is defined in mixed case letters (if the column name is all in small or capital letters there is
no need for quoting the column name)

2) I guess that the problem is that there's no finishing semicolon (;) for the statement,
because the native Oracle SQL-command interpreter 'sqlplus' requires a semicolon at
the end of each SQL statement

3) Don't call the table which You want to update 'table'
'table' is a reserved word in SQL and for the update-statement You have to specify
the name of the table (i.e.: namelist ) - and make sure that You have created the 
table via a 'CREATE TABLE ...' statement before and inserted some values in it

That's my five cent...

best wishes,

Ralf

Liam Clarke <cyresse at gmail.com> schrieb am 30.03.05 02:14:05:
> 
> >From what little SQL I know, 
> 
> try using your quotation marks differently, see if it helps.
> 
> strUpdate = 'UPDATE table SET firstname = "JOSEPH" WHERE lastname = "SMITH" '
> 
> Good luck, 
> 
> Liam Clarke
-snip
> > script will print all of the print commands up to the
> > cursor.execute(strUpdate) command, but not those after it.  Therefore, I
> > think that the cursor.execute(strUpdate) is the source of the problem.
> > Also, when I manually query the database, the records within the table have
> > not been changed.
> > 
> > Thanks,
> > 
> > Tom
-snip
> > strUpdate = " UPDATE table SET firstname = 'JOSEPH'  WHERE lastname =
> > 'SMITH' "




More information about the Tutor mailing list