How to execute stored procedure with cursor.callproc() many times, for list of input parameters? #78
-
Hi, is it possible to execute stored procedure using cursor.callproc() but using it in a way similar to cursor.executemany()? i have a stored procedure which accepts two input arguments, im running it like this: cursor.callproc('my_stored_procedure', ['P00000012345678','T0000087654321']) In case i have a list of input parameters for which i need to execute stored procedure, is there some other more efficient way than loop? input_parameters = [['P00000011345678','T0000088654321'],['P00000011145678','T0000088854321'],['P00000011115678','T0000088884321'],['P00000011111678','T0000088888321']] BR, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, you can do this: cursor.executemany("""
begin
my_stored_procedure(:1, :2);
end;""", input_parameters) The method |
Beta Was this translation helpful? Give feedback.
Yes, you can do this:
The method
cursor.callproc()
effectively generates that anonymous PL/SQL block for you automatically -- so you can simply specify it manually for use incursor.executemany()
.