I have this simple procedure for my trigger function.
BEGIN SET @a := (SELECT SUM(transaksi_alat_pinjam_detail.jumlah_kembali) FROM transaksi_alat_pinjam_detail