[cx-oracle-users] trouble with insert
Brought to you by:
atuining
From: Andrew R. <and...@gm...> - 2005-04-14 19:53:51
|
--- #!/usr/bin/python =20 import sys import cx_Oracle =20 =20 dbinst =3D sys.argv[1] dbuser =3D sys.argv[2] dbpass =3D sys.argv[3] =20 try: myconn =3D cx_Oracle.connect(dbuser,dbpass,dbinst) except cx_Oracle.DatabaseError, x: print "" print "Unable to connect to Database." print x =20 =20 =20 cursor =3D myconn.cursor() cursor.arraysize =3D 50 cursor.execute(""" SELECT content_style_id_seq.nextval FROM dual""") =20 =20 def add_theme(): for content_style_id in cursor.fetchall(): nextval =3D str(content_style_id[0]) cursor.execute(""" INSERT INTO CONTENT_STYLE (CONTENT_STYLE_ID, NAME, DESCRIPTION, THEME, CLIENT, DELETED) VALUES (:content_id, ':vizstylename', ':themedesc', ':themename', ':vizstylename', 0)""", content_id =3D nextval, themename =3D sys.argv[4], vizstylename =3D sys.argv[5], themedesc =3D sys.argv[6]) myResults =3D cursor.fetchall() if cursor.rowcount =3D=3D 0: print "The theme could not be added for an unknown reason." else: cursor.execute("""COMMIT""") print "Theme ",sys.argv[4],"added with content style",sys.argv[5],"and description",sys.argv[6] =20 =20 add_theme() --- andrewr@zepher:~/bin$ ./add_theme.py PSG MGMTUSER01 MGMTUSER01 prenhalltheme prenhall PrenticeHall Traceback (most recent call last): File "./add_theme.py", line 42, in ? add_theme() File "./add_theme.py", line 33, in add_theme content_id =3D nextval, themename =3D sys.argv[4], vizstylename =3D sys.argv[5], themedesc =3D sys.argv[6]) cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number --- I have no idea what the illegal variable name / number is.. I've read issues where the variable is 32 char or longer or if a : missing in front of the variable assignment .. but none of these apply here.. can anyone tell me what I'm doing wrong? TIA, Andrew Replogle |