Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ibm_db.callproc should return the stored procedures return value #925

Open
sleakehe opened this issue Apr 2, 2024 · 2 comments
Open

ibm_db.callproc should return the stored procedures return value #925

sleakehe opened this issue Apr 2, 2024 · 2 comments

Comments

@sleakehe
Copy link

sleakehe commented Apr 2, 2024

Is your feature request related to a problem? Please describe.
ibm_db.callproc() currently returns a statement object that can be used to access result sets, and the in/out arguments. However, if the stored procedure returns some custom value via a RETURN statement, there is no way to capture that value.

Example proc:

CREATE OR REPLACE PROCEDURE check_odd_day ()
LANGUAGE SQL
BEGIN
    DECLARE current_day INT;
    DECLARE result INT;
    
    -- Get the current day
    SET current_day = DAY(CURRENT DATE);
    
    -- Check if the current day is odd
    IF MOD(current_day, 2) <> 0 THEN
        SET result = 1000;
    ELSE
        SET result = 2000; 
    END IF;
    
    RETURN result;
END

Describe the solution you'd like
I'd like ibm_db.callproc() to return the stored procedures return value.

@bchoudhary6415
Copy link
Contributor

bchoudhary6415 commented Apr 18, 2024

Hello @sleakehe 
Please check the examples of ibm_db.callproc: https://github.com/ibmdb/python-ibmdb/wiki/APIs#ibm_dbcallproc.
As you are suggesting that ibm_db.callproc() return the stored procedure return value,
Can you please share a sample script for how ibm_db.callproc() can return the stored procedure return value and be able to display the output?

Please try to give sample output also, so that we can make progress on this enhancement part if required.

Thanks

@Earammak
Copy link
Collaborator

@sleakehe, Can you please share the update for this?
Thanks

@bimalkjha bimalkjha reopened this Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants