Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么分号在cx\U Oracle中是无效字符?_Python_Database_Cx Oracle - Fatal编程技术网

Python 为什么分号在cx\U Oracle中是无效字符?

Python 为什么分号在cx\U Oracle中是无效字符?,python,database,cx-oracle,Python,Database,Cx Oracle,我对数据库比较陌生,有人能给我解释一下为什么会这样吗 例如,以下给出了无效字符错误: dsn_tns = cx_Oracle.makedsn(ip, port, SID) # cx_Oracle.connect([user, password, dsn, mode, handle, pool, threaded, events, cclass, # purity, newpassword, encoding, nencoding, edition, appcontext, tag, mat

我对数据库比较陌生,有人能给我解释一下为什么会这样吗

例如,以下给出了无效字符错误:

dsn_tns = cx_Oracle.makedsn(ip, port, SID)

# cx_Oracle.connect([user, password, dsn, mode, handle, pool, threaded, events, cclass,
#   purity, newpassword, encoding, nencoding, edition, appcontext, tag, matchanytag])
conn = cx_Oracle.connect(user = username, password = password, dsn = dsn_tns)

cur = conn.cursor()
cur.execute("select * from MYTABLE;")

execute()
方法只接受一个SQL命令,分号永远不是命令的一部分。它用于分隔按顺序执行的多个命令。

Cool,接下来的问题是:如何使用executemany以分号执行此查询?(不太确定第二个参数应该是什么。)当然,出于教学目的。
executemany()
不用于执行多个语句,而是用于按顺序执行具有多个绑定的单个语句。啊,现在更有意义了!是否可以使用cx_Oracle执行多个以分号分隔的命令?