When I am trying to insert data into DB and i can see the above error when i am using below code.
Could you please suggest what else can be done.
Code:
list_to_add=['Have you searched','similar question has already been posted']
dsn_tns = cx.makedsn(cred_test['HOST'], cred_test['PORT'], service_name=cred_test['SERVICE_NAME'])
conn = cx.connect(user=cred_test['USER'], password=cred_test['PASWRD'], dsn=dsn_tns)
cursor = conn.cursor()
cursor.prepare('INSERT INTO Table_name Col_name values (:0)')
cursor.executemany(None,list_to_add)
conn.commit()
You have minor issues :
ORA-01036 raises due to list elements are not wrapped up with square brackets
ORA-00947 will raise after fixing the first matter, since the Col_name
is not wrapped up with parentheses within the Insert statement
list_to_add=[['Have you searched'],['similar question has already been posted']]
dsn_tns = cx.makedsn(cred_test['HOST'], cred_test['PORT'], service_name=cred_test['SERVICE_NAME'])
conn = cx.connect(user=cred_test['USER'], password=cred_test['PASWRD'], dsn=dsn_tns)
cursor = conn.cursor()
cursor.prepare('INSERT INTO Table_name(Col_name) VALUES(:0)')
cursor.executemany(None,list_to_add)
conn.commit()