Multiple select and update statements in a single stored procedure

Hi All,

I have one requirement where i have to update 3 tables (i need to make some rows as inactive based on the conditions i have) where as these 3 tables are inter related and i have to select primary key form table 1 to update table 2 , and if need to update table 3 i have to select PK of table 2 in turn i have to select PK of table 1 

so for this i have written single mysql stored procedure with three update statements in one update statement two selection in turn , in one update statement one selection(to select relation) , its working fine but my question here is is this approach to write stored procedure is fine ? 

I can't assign the relation to one variable because it might return multiple values where that is not supported in stored procedure.

 

Thanks,

Bhargavi P 

  Discussion posts and replies are publicly visible