Re: [cx-oracle-users] INSERT examples
Brought to you by:
atuining
From: Mark H. <mh...@pi...> - 2010-06-17 21:06:40
|
On 6/17/10 1:33 PM, Robert wrote: > How to make below code work ? > curs1 has 8 columns, I want to insert into table with 9 columns - 'FOO' in col_9 > > >> for row in curs1: >> curs2.execute('insert into emp2(empno,ename,job,mgr,hiredate,sal,comm,deptno, col_9) values (:1,:2,:3,:4,:5,:6,:7,:8)',row, 'FOO') >> > > TypeError: function takes at most 2 arguments (3 given) do this: print row and you will see that it is a list of length 8 that corresponds to the row fetched from curs1. so, do these two things: - add :9 to the values clause, to correspond with col_9 - add 'FOO' to row, so there will be 9 items in the list row.append('FOO') and it should be good. |