为什么cx_Oracle和sqlplus对相同的选择查询给出不同的结果



通过使用Python和cx_Oracle,我试图将行插入到表中。

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()

从输入文件中插入所有行后,通过在cx_Oracle中使用select query,我可以看到插入的行。但是,当我输入"select * from table;"时,sqlplus没有给出任何结果。是否有一些东西,我错过了关于cx_Oracle或有一个缓冲区在oracle客户端,显示旧的结果与sqlplus当它连接到远程数据库?

是否提交了insert?

con.commit() #after inserts

con.autocommit = true #before inserts

我有一个倒置的问题:我使用sqlquery添加行,经过2小时的痛苦阅读这篇文章和猜测,我应该关闭我的会话。我关闭了控制台,并设法获得了我的数据!

最新更新