[DB-SIG] Insert for Oracledb
Fri, 21 Nov 1997 08:44:11 -0500 (EST)
Here's a quick, dirty example...
>>> import oracledb
>>> cobj = oracledb.oracledb('foo/bar')
>>> cu = cobj.cursor()
>>> a = (1,11714,10,0,'Bob')
>>> qs = "INSERT INTO ppiOrder (orderID,accountID,amount,discountPercent,salesRepName) VALUES (" + str(a) + "," + str(a) + "," + str(a) + "," + str(a) + ",'" + a + "')"
"INSERT INTO ppiOrder (orderID,accountID,amount,discountPercent,salesRepName) VALUES (1,11714,10,0,'Bob')"
You might also have your program send the query string to the stdout
or stderr to see what it looks like. Try it in sqlplus, it will
give you a little bit better error diagnostics.
Hope this helps,
> Please can someone send me a working code sample of how they
> successfully used the oracledb module (from Digital Creations) to insert
> one or more rows into an oracle database, preferably based on a List of
> previously constructed Tuples.
> I have looked at the example posted by Andrew Kuchling (for Solid), and
> read most of the past email, including a discussion about binding of
> variables using the :N notation. However, although I can query the
> database I have had no success at inserting rows, except by hardcoding
> the values into the sql string.
> Whatever I try I seem to get Parse errors, or too many arguments, or
> sql not properly terminated, or missing parens, or something! - even
> for 1 row.
> There seems to be very little activity on this SIG, with no updates to
> database API documentation since 1996! Is there really no-one out
> there using this stuff, for Oracle?
> Would appreciate help
> Vicky White
> DB-SIG - SIG on Tabular Databases in Python
> send messages to: email@example.com
> administrivia to: firstname.lastname@example.org
DB-SIG - SIG on Tabular Databases in Python
send messages to: email@example.com
administrivia to: firstname.lastname@example.org