SET ECHO ON
SET FEEDBACK ON
SET TERMOUT ON
SET SERVEROUTPUT ON

UPDATE com_mailing_status_detail
   SET com_mailing_status_type_id = 1615186
 WHERE com_mailing_status_detail_id IN (
          SELECT   MAX (com_mailing_status_detail_id)
              FROM com_mailing m, com_mailing_status_detail md
             WHERE m.com_mailing_id = md.com_mailing_id
               AND m.com_letter_template_id = 100100
          GROUP BY md.com_mailing_id);
          
          
          
          
DEFINE UOW = &1


BEGIN
   IF UPPER('&UOW') = 'COMMIT' THEN
      COMMIT;
      DBMS_OUTPUT.PUT_LINE(' ');
      DBMS_OUTPUT.PUT_LINE('COMMIT ISSUED!');
      DBMS_OUTPUT.PUT_LINE(' ');
   ELSIF UPPER('&UOW') = 'NONE' THEN
      DBMS_OUTPUT.PUT_LINE(' ');
      DBMS_OUTPUT.PUT_LINE('NO COMMIT OR ROLLBACK ISSUED because NONE was requested.');
      DBMS_OUTPUT.PUT_LINE(' ');
   ELSE
      ROLLBACK;
      DBMS_OUTPUT.PUT_LINE(' ');
      DBMS_OUTPUT.PUT_LINE('ROLLBACK ISSUED!');
      DBMS_OUTPUT.PUT_LINE(' ');
   END IF;
END;
/          
