2016-02-05 61 views

回答

1

觸發創建存儲過程

DB::unprepared("create PROCEDURE `updateTotal` 
(IN `rate` int,IN `qty` int, IN `id` int) 
BEGIN 
set @total := (rate * qty); 
set @id := id; 
UPDATE products set total = @total where id = @id; 
END"); 

調用程序的方法來調用存儲過程

DB::statement("CALL updateTotal('50', '5', '47')"); 

結果更新: w.r.t id 47

相關問題