By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,575 Members | 1,303 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,575 IT Pros & Developers. It's quick & easy.

How To Create A Procedure That Returns 2 Variables

P: 1
I want to ensure every serial number in a table has the same amount after each update to avoid a situation where the same serial number holds different values in different rows .


CREATE TRIGGER myupdate (a,b)
AFTER INSERT ON myTable
FOR EACH ROW
BEGIN
SELECT a=lastInsertedAmount
SELECT b=lastInsertedSerialNumber
END

CREATE PROCEDURE myUpdate(a,b)
BEGIN
UPDATE myTable
SET Amount = a
WHERE SerialNumber = b;
END
Jun 10 '14 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,043
If you really want to avoid this, you should put your serial number, and the amount in another table. This way you will only have one record which will hold the amount per serial number.
Jun 10 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.