3

Trying to call an existing stored procedure, but using named parameters, first parameter should retain default value (in this case NULL).

I've spent way too long trying to get this working, any ideas?

create or replace procedure so_test(p1 in varchar2 default null, p2 in     varchar2  default null, p3 in varchar2  default null) as
begin
    null;
end;

import cx_Oracle
db = cx_Oracle.connect('/@XTS_DEV.CLIENT')
cur = db.cursor()
cur.callproc("so_test", ('X', 'Y', 'Z'))
cur.callproc("so_test(p2=>:1, p3=>:2)", ('Y', 'Z'))

Traceback (most recent call last):
  File "C:\Users\PatrickJolliffe\so_test.py", line 5, in <module>
    cur.callproc("so_test(p2=>:1, p3=>:2)", ('Y', 'Z'))
cx_Oracle.DatabaseError: ORA-06550: line 1, column 7:
PLS-00801: internal error [22503]
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

1 Answer 1

5

The documentation (http://cx-oracle.readthedocs.io/en/latest/cursor.html#Cursor.callproc) covers this but since no examples are provided there I can see how that might be confusing. :-)

For your example, this is what you want:

cursor.callproc("so_test", keywordParameters = dict(p2 = "Y", p3 = "Z"))
Sign up to request clarification or add additional context in comments.

1 Comment

How would this return, with a list of input and output in the same order as procedure?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.