CREATE DEFINER=`root`@`localhost` PROCEDURE `getUserQuoteValue`(IN itemId bigint,IN amount float,IN quantity int)
BEGIN
DECLARE ty Varchar(40);
SELECT type INTO ty
FROM quoteitem WHERE id = @itemid;
IF
ty='servicemargin' then
update quoteitem set type= 'servicemargin',amount=amount, quantity=quantity, total=amount*quantity, margin=total/100 *(select marginvalue from setting where type='servicemargin'), finaltotal=(total-margin)where Id=itemid;
else
update quoteitem set type='material',amount=amount, quantity=quantity, total=amount*quantity, margin=total/100 *(select marginvalue from setting where type='material'), finaltotal=(total-margin)where Id=itemid;
end if;
END
this is my stored procedure .if i call from the stored procedure(itemid,quantity,amount)it should be represented in the quote table ...i have created four tables (setting,quote,quoteitem,user)now how could i represent the result in the quote table what are the expression wanted .please give me explanation with the query