I want to insert a row into table. But i got TypeError: expecting string or bytes object this error.
Traceback (most recent call last): File "d:\Git\Repos\mavi\oracle_connection.py", line 19, in c.prepare(QUERY,{"expr":expr, "expr2":expr2}) TypeError: expecting string or bytes object
import cx_Oracle
dsn_tns = cx_Oracle.makedsn(***)
conn = cx_Oracle.connect(***)
c = conn.cursor()
expr = bytes('', 'utf-8')
expr2 = bytes('ML_TEST', 'utf-8')
QUERY = '''
INSERT INTO dev_log (LOG, SQ_DEV_LOG_ID, LF_TEKLIF_WS, PACKAGE BODY, LINE_NO)
VALUES
(:expr,:expr,:expr2,:expr,:expr)
'''
rows = []
c.prepare(QUERY,{"expr":expr, "expr2":expr2})
c.executemany(None, rows)
conn.commit()
conn.close()
How can i fix this problem?
expris used forinteger,stringandclobat the same time.