Monday, January 20, 2014

zxJDBC, invoking stored procedures passing parameters (zxjdbc callproc)

for the 2 world users of zxJDBC:
This works, the stored procedure is defined as:
create or replace 
PROCEDURE PVTESTPROC AS 
BEGIN
  INSERT INTO PVTEST (COLUMN1) VALUES ('mamma');
  commit;
END PVTESTPROC;



and the Python code to invoke it:

#grab somehow a connection object (conn) for the DB
....
#then invoke stored procedure
procedure='PVTESTPROC'
c  = conn.cursor()
params = [None]
c.callproc(procedure, params)


This fails, I have simply added a parameter:

create or replace 
PROCEDURE PVTESTPROC
(
  PARAM1 IN VARCHAR2  
) AS 
BEGIN
  INSERT INTO PVTEST (COLUMN1) VALUES (PARAM1);
  commit;
END PVTESTPROC;


and the Jython code is the same as before, but with params = ['PLUTO'] . This fails with "PLS-00306: wrong number or types of arguments in call to 'PVTESTPROC'"

see also same problem reported here http://code.activestate.com/lists/python-list/291477/ Frankly I give up.... I think there is definitely some problem with such an old version of Python

No comments: