Procedure execute inside SQL Developer, but not inside a script
I had a procedure that was not working. If I tried to run: "BEGIN proc_name; END;" in SQL Developer or via script I had the same error.
I've fixed the procedure and now when I run that same command in SQL Developer, it's fine, but the script returns an error.
When I try:
..开发者_JS百科.
sql = """EXEC proc_name"""
con = connection.cursor()
con.execute( sql )
...
I get DatabaseError: ORA-00900: invalid SQL statement, but probably is because of that: Problem with execute procedure in PL/SQL Developer and I'm not really worried about it.
What is really making me curious is when I try:
...
sql = """BEGIN proc_name;END;"""
con = connection.cursor()
con.execute( sql )
...
I get the same error that I had before fix the procedure. Do you have any idea what is going on?
PS: This is a python script using cx_Oracle and I'm using Oracle 10g.
Try using the callproc() or callfunc() method on the cursor, instead of execute(). They are not exactly Py DB API compatible, but should do the job for cx_Oracle...
精彩评论