Python cx_Oracle. shock head with execution ()

I spent most of yesterday looking at questions here and around the Internet, and I couldn’t, however, understand what I was missing. I'm pretty sure it must be something really stupid, but now I'm burning.

So the code:

temp_table_name = 'COMPTEMP.i'+todo_name+'_MSGRUN'
sql_create_table = "CREATE TABLE "+temp_table_name+" (CL VARCHAR2(255)) NOLOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING"
DB_GATEWAY.execute(sql_create_table)

(this is created normally)

sql_fill_table_header = """INSERT INTO """+temp_table_name+""" (CL) VALUES (:1)"""
sql_fill_table_build = []
sql_fill_table_build = ['1', '2', '3', '4', '55']

DB_GATEWAY.executemany(sql_fill_table_build, sql_fill_table_header)

(this now applies to the session pool protector, which ends below)

def executemany( self, db_operation, db_prepare ):
    self.cursor_.prepare(db_prepare)
    self.cursor_.executemany(None, db_operation)

When doing this, I get fpllowing error

OracleException:  ORA-01036: illegal variable name/number

If I remove the value “55” from the list, all the others will be added in order, so it looks like it only accepts values ​​of length <char.

When I run each statement via execute (), they get up. I'm sure it should do something with the code or the way Oracle works with positional arguments, but I'm already lost.

Appreciate the help!

+4
1

executemany() ; , :

sql_fill_table_build = [('1',), ('2',), ('3',), ('4',), ('55',)]

:

sql_fill_table_build = [['1'], ['2'], ['3'], ['4'], ['55']]

, '55', , , '55' . , : '5' '5', .

- API , :

DB_GATEWAY.executemany(sql_fill_table_build, [(v,) for v in sql_fill_table_header])

cx_Oracle, , :

DB_GATEWAY.executemany(sql_fill_table_build, ((v,) for v in sql_fill_table_header))

, cx_Oracle .

+3

All Articles