Reputation: 46
I'm trying to run an ALTER USER statement using the python module cx_Oracle, but I'm receiving the error "cx_Oracle.DatabaseError: ORA-00922: missing or invalid option"
dsn = cx_Oracle.makedsn(host_name, port, service_name=service_name)
con = cx_Oracle.connect(user=DB_USER, password=DB_PASSWD, dsn=dsn)
cursor = con.cursor()
generated_passwd = random_passwd()
sql = "ALTER USER " + user_to_reset + " IDENTIFIED BY \"" + generated_passwd + "\";"
print(sql)
cursor.execute(sql)
here is a sample query generated by my code that throws the ORA-00922 error when ran through cx_oracle:
ALTER USER john IDENTIFIED BY "vJe3lfRI9zma";
this query works in sqlplus so I'm not sure what I'm doing wrong here. any help would be appreciated
Upvotes: 0
Views: 1658
Reputation: 46
I found the answer. The semicolon at the end of my PL/SQL statement is the culprit of the error.
ALTER USER john IDENTIFIED BY "vJe3lfRI9zma"
works just fine in cx_Oracle.
Upvotes: 1