Jon Martin
Jon Martin

Reputation: 3392

cx_Oracle callproc() method

I'm getting an error when using callproc() to call a stored procedure with parameters.

cur.callproc("TEST.manage_partitions_pkg.test", ["to_date('20120525', 'YYYYMMDD')", 1,     "tablename_type('MESSAGE', 'VALID_MESSAGE')", True, True])

But it doesn't seem to recognize the SQL parameters. Do I somehow need to translate the SQL parameters into python? If so, how would that be done?

Upvotes: 0

Views: 3932

Answers (1)

Christian Witts
Christian Witts

Reputation: 11585

Your first parameter should be a cx_Oracle.Date object which you can construct with cx_Oracle.Date(2012, 5, 25). Your third parameter I take is just a string and you're not expecting it to be a function call, which if it is, you can do with cur.callfunc('tablename_type', ReturnType, ['MESSAGE', 'VALID_MESSAGE']) and inline it into your procedure call.

Upvotes: 2

Related Questions