Python uses CX_ Oracle batch insert error report ora-01036 error solution

Recently, in the process of using Python to write data import program, CX is used_ When the Oracle database was imported into Oracle database, there was an error of “ora-01036: illegal variable name/number”. After querying the data and trying, the problem was solved.

The Error statement is:

sql = ‘insert into \”mytable_ a\” values(%s,%s,%s)’

cursor.executemany (sql, data)

As a result, the error “ora-01036: illegal variable name/number” appears.

resolvent:

Change the place holder of parameter transfer to “: 1,: 2,: 3”,

The modified statement is as follows:

sql = ‘insert into \”mytable_ a\” values(:1, :2, :3)’

cursor.executemany (sql, data)

Execute again and solve the problem.

Read More: