简体   繁体   中英

Python mysql stored procedure callproc() doesnt work

I have a stored procedure on mysql database.When I call this procedure on phpmyadmin

CALL bakiyesifirla('Deneme');


CREATE PROCEDURE bakiyesifirla(IN cadres varchar(500)) 
BEGIN 
    set @bakiye=0; 
    CALL bakiyecek(cadres,@bakiye); 
    IF @bakiye<0 THEN 
       CALL bakiyeguncelle(0,cadres); 
    END IF; 
END; –

it works fine but when I try to call it on python with

  cadres='Deneme'
  mycursor = mydb.cursor()
  mycursor.callproc('bakiyesifirla',[cadres,])
  mycursor.close()

it doesnt give any error but it wont make any difference.

use a tuples not arrays

mycursor.callproc('bakiyesifirla',(cadres,))

But i can't see how you can check, if the procedures are called or not.

Add some out paramters to check,if also the sub stored procedures are running see the link provided

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM