Pergunta

By using Python and cx_Oracle, I am trying to insert rows to a table.

con = cx_Oracle.connect(ORACLE_USER+'/'+PASS+'@'+TNS)
cursor = con.cursor()
...
try:
    cursor.executemany("INSERT INTO table(ID,NAME) VALUES(...)"
except cx_Oracle,exc:
    error ,=exc.args
    print error.code
    print error.message
cursor.close()
con.close()

After insert all the rows from an input file, by using select query in cx_Oracle, I can see the inserted rows. However, sqlplus gives no results when I enter "select * from table;" Is there something that I missed about cx_Oracle or is there a buffer in oracle client that shows the old results with sqlplus when it is connected to a remote db?

Foi útil?

Solução

Have you committed your insert?

con.commit() #after inserts

or

con.autocommit = true #before inserts

Outras dicas

I had an inverted problem: I added rows using sqlquery and after 2 hours of suffering read this post and guess, that I should close my session. I closed the console and managed to get my data!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top