Re: [cx-oracle-users] setinputsizes problem?
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2010-07-05 20:11:02
|
Ok, let me see if I can clear things up. If you want to use positional parameters, you need to do the following: cursor.setinputsizes(cx_Oracle.CLOB) cursor.execute("insert.... values (:1)", (clobValue,)) cursor.setinputsizes(None, None, cx_Oracle.CLOB) cursor.execute("insert.... values (:1, :2, :3), (1, "String", clobValue)) If you want to use named parameters, you need to do the following: cursor.setinputsizes(value1 = cx_Oracle.CLOB) cursor.execute("insert.... values (:value1)", value1 = clobValue) cursor.setinputsizes(value3 = cx_Oracle.CLOB) cursor.execute("insert.... values (:value1, :value2, :value3)", value1 = 1, value2 = "String", value3 = clobValue) Where clobValue refers to the actual string contents. Hopefully that explains things well enough? If not, show me your exact code and I'll attempt to show you where you are going wrong. Anthony On Mon, Jul 5, 2010 at 12:56 PM, Jason Boorn <jb...@gm...> wrote: > > I set up clobs as {}, inputsizes as {} and populate a single value in the > SQL statement: > > INSERT INTO . . . VALUES (:value1, . . .) > > clobs['value1'] = <some string> > inputsizes['value1']=cx.Oracle > > I call: > > destination_cursor.setinputsizes(inputsizes) > > destination_cursor.execute(executestring, clobs) > > I get an error: > > Could not insert temp: Variable_TypeByPythonType(): unhandled data type > > This was the original error which led me to use an array for clobs in the > first place. Ideas? > > > > On Sun, Jul 4, 2010 at 5:27 PM, Amaury Forgeot d'Arc <ama...@gm...> > wrote: >> >> 2010/7/4 Jason Boorn <jb...@gm...>: >> > now I get the following: >> > >> > >> > ORA-01036: illegal variable name/number >> > >> > I tried defining the input by both position (:1) and by named argument >> > (:value1) >> > >> > By position, >> > My SQL expression reads : INSERT INTO . . . values (:1, null . . .) >> > And my execution is (cursor.execute(sql, *clobs)) >> >> Here it's the other way round :-) >> The documentation of cursor.execute: >> http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.execute >> states that the parameters must be given as one sequence. >> Try with >> cursor.execute(sql, *clobs) >> >> >> -- >> Amaury Forgeot d'Arc >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |