MySQL Forums
Forum List  »  Stored Procedures

Re: Stored Proceedure Not doing anything...?
Posted by: Peter Brawley
Date: June 02, 2018 11:27AM

Once the declaration of _new_category_id is moved above the cursor declaration, it compiles.

However ...

(i) the logic is suspect. the product_id value that's just been inserted should be retrieved with last_insert_id(), not with select max(prodct_id...), which can return the wrong value.

(ii) It's poor practice to write table identifers in camel or "Hungarian" case.

(iii) it does no error handling or reporting. and since it's supposed to be writing data, it should.

You have the tables & data, we don't, so only you can debug it. The method is to write Select stubs showing how each step proceeds.

Whether it otherwise behaves according to the spec, I can't tell without the tables and sample data.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Stored Proceedure Not doing anything...?
163
June 02, 2018 11:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.