Я пытаюсь передать переменную из ввода в оператор SQL, который я хочу выполнить. Я получаю сообщение об ошибке неверного символа. Заранее благодарю за помощь
import cx_Oracle
import pandas as pd
con = cx_Oracle.connect(user/password@database')
print("Enter the \"SQLID\" to search")
test = input()
cur = con.cursor()
#cur.prepare('select * from dba_users where username = :sql_id')
cur.prepare('select sample_time,session_id,session_serial\#,sql_id,sql_plan_hash_value,wait_time \
from v$active_session_history \
where sql_id = :id \
order by sample_time desc')
cur.execute(None, {'id': test})
columns = [desc[0] for desc in cur.description]
data = cur.fetchall()
df = pd.DataFrame(list(data), columns=columns)
writer = pd.ExcelWriter('Data.xlsx')
df.to_excel(writer, sheet_name='TEST1')
writer.save()
res = cur.fetchall()
print(res)
cur.close()
con.close()
Входная переменная Varchar вот пример 5m6mu5pd9w028