PostgreSQL FOR IN SELECT LOOP FUNCTION

CREATE OR REPLACE FUNCTION lerp_get_order_summary(p_order_uuid uuid, OUT o_total_sum real, OUT o_total_sum_tax real, OUT o_total_sum_end real)
as
$$
DECLARE
    tmp_row RECORD;
BEGIN
    o_total_sum := 0;
    o_total_sum_tax := 0;

    FOR tmp_row IN
        SELECT order_item_price, order_item_price_total, order_item_taxp
        FROM order_item
        WHERE order_uuid = p_order_uuid
        LOOP
            o_total_sum := o_total_sum + tmp_row.order_item_price_total;
            o_total_sum_tax := o_total_sum_tax + (tmp_row.order_item_price_total * (tmp_row.order_item_taxp / 100::float)); -- 100.0 or 100::float ...otherwise result is 0
        END LOOP;

    o_total_sum := o_total_sum;
    o_total_sum_tax := o_total_sum_tax;
    o_total_sum_end := o_total_sum + o_total_sum_tax;
END;
$$ LANGUAGE plpgsql;

alter function lerp_get_order_summary(uuid) owner to postgres;