[cx-oracle-users] Update problem
Brought to you by:
atuining
From: Jesse G. L. <jg...@be...> - 2007-01-17 02:11:54
|
I have some code that works fine when I query, but when try an update statement I get a response back of "Expecting string or none" my code looks something like this [code] import cx_Oracle from pprint import pprint xl = readexcel('users701.xls') sheetnames = xl.worksheets() dbuser = 'user/password@blue' connect = cx_Oracle.Connection("%s" % (dbuser)) cursor = cx_Oracle.Cursor(connect) i = 1 for sheet in sheetnames: for row in xl.getiter(sheet): #sql = "select * from T_PERSONNEL" if (i > 50): break sql = """UPDATE T_PERSONNEL SET last_name = '%s',first_name = '%s' WHERE login = '%s'""" % (row['Last Name'], row['First Name'], row['ID']) print sql cursor.execute(sql) #data = cursor.fetchall() #pprint(data) i = i + 1 cursor.close() connect.commit() [/code] The commented parts is for testing. Just left it in to keep myself straight. I had to put in the if statement because it continues to run the excel spreadsheet even through blank entries. Any help is appreciated. -- JLands Arch Current Registered Linux User #290053 Success is as dangerous as failure, and we are often our own worst enemy. |