Skip to content

How to execute stored procedure with one input and many output parameters #303

Closed Answered by anthony-tuininga
urosdigital asked this question in Q&A
Discussion options

You must be logged in to vote

Creating variables is the correct way of handling output parameters. You can reuse the variables as many times as you like. Each time you call the procedure new values will be populated. You can call multiple times as follows:

imsi = cursor.var(str)
iccid = cursor.var(str)
status = cursor.var(str)
for msisdn in ['1234567890', '9876543210', '9988776655']:
    cursor.callproc('main_user.user_who_can_execute_procedure.DisplaySim', [msisdn, imsi, iccid, status])
    out_imsi = imsi.getvalue()
    out_iccid = iccid.getvalue()
    out_status= status.getvalue()
    print(f'Simcard: {out_iccid} with imsi: {out_imsi} has {out_status} age status for msisdn: {msisdn}')

If you know you are going to b…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@anthony-tuininga
Comment options

Answer selected by urosdigital
@urosdigital
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants