PROCEDURE cust_reports (p_c_id IN INTEGER,                                     /* PL/SQL */
                        p_c_name OUT VARCHAR (50),
                        p_o_name OUT VARCHAR (50),
                        p_cr_text OUT VARCHAR (255))
IS
BEGIN
    EXECUTE IMMEDIATE
        'SELECT c.company_name, o.name, cr.text '                 ||
        'FROM sh.customer c, sh.office o, sh.customer_report cr ' ||
        'WHERE c.id = :p_c_id '                                   ||
        'AND cr.customer_id = c.id '                              ||
        'AND cr.office_id = o.id '                                ||
        'ORDER BY o.name ASC'
    INTO 
        p_c_name, p_o_name, p_cr_text
    USING
        p_c_id;
END;