![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
-----Original Message----- From: info-ingres-admin (AT) cariboulake (DOT) com [mailto:info-ingres- admin (AT) cariboulake (DOT) com] On Behalf Of morgan brickley Sent: Tuesday, August 02, 2005 4:11 PM To: info-ingres (AT) cariboulake (DOT) com Subject: [Info-ingres] not possible to return values from stored procedure using ingresdbi for python Hey all, Am I right in stating that it is not possible to retrieve results from a stored procedure in ingres to a python script using thhe ingresdbi driver? The obvious work-around is to follow up the stored proc with a direct SELECT statement, but this seems inefficient. So you CAN do this : exeStr = "execute procedure team_create(in_userId=" + in_userId +",in_teamName='" + in_teamName + "')"; c.execute( exeStr ) exeStr = "SELECT teamID FROM Teams WHERE (teamname='" + in_teamName + "')"; c.execute( exeStr ) rows = c.fetchall() newTeamId = rows[0][0] but you CAN'T do this : exeStr = "execute procedure team_create_with_return(in_userId=" + in_userId +",in_teamName='" + in_teamName + "')"; c.execute( exeStr ) rows = c.fetchall() newTeamId = rows[0][0] nor can you use fetchone() here, and nope it doesn't matter whether the stored proc itself actually returns a single value using 'return' or uses the iterator style 'result row' and the 'for ... end for' method of returning values.. Should we be able to do this ? Morgan _______________________________________________ Info-ingres mailing list Info-ingres (AT) cariboulake (DOT) com http://mailman.cariboulake.com/mailm...py/info-ingres |
#2
| |||
| |||
|
|
Hi, It is possible if you a looking at a procedure that returns rows. Take a look at the following example - http://ingres.ca.com/pipermail/users...er/000022.html Regards, grant -----Original Message----- From: info-ingres-admin (AT) cariboulake (DOT) com [mailto:info-ingres- admin (AT) cariboulake (DOT) com] On Behalf Of morgan brickley Sent: Tuesday, August 02, 2005 4:11 PM To: info-ingres (AT) cariboulake (DOT) com Subject: [Info-ingres] not possible to return values from stored procedure using ingresdbi for python Hey all, Am I right in stating that it is not possible to retrieve results from a stored procedure in ingres to a python script using thhe ingresdbi driver? The obvious work-around is to follow up the stored proc with a direct SELECT statement, but this seems inefficient. So you CAN do this : exeStr = "execute procedure team_create(in_userId=" + in_userId +",in_teamName='" + in_teamName + "')"; c.execute( exeStr ) exeStr = "SELECT teamID FROM Teams WHERE (teamname='" + in_teamName + "')"; c.execute( exeStr ) rows = c.fetchall() newTeamId = rows[0][0] but you CAN'T do this : exeStr = "execute procedure team_create_with_return(in_userId=" + in_userId +",in_teamName='" + in_teamName + "')"; c.execute( exeStr ) rows = c.fetchall() newTeamId = rows[0][0] nor can you use fetchone() here, and nope it doesn't matter whether the stored proc itself actually returns a single value using 'return' or uses the iterator style 'result row' and the 'for ... end for' method of returning values.. Should we be able to do this ? Morgan _______________________________________________ Info-ingres mailing list Info-ingres (AT) cariboulake (DOT) com http://mailman.cariboulake.com/mailm...py/info-ingres |
![]() |
| Thread Tools | |
| Display Modes | |
| |