-- ABS-111435/ABS-112818

ALTER TABLE ROUTETRANSTYPEREASONCODE
	ADD (SEQUENCENUMBER NUMBER NULL);

MERGE INTO ROUTETRANSTYPEREASONCODE R
 USING(SELECT RTY.*,
                               ROW_NUMBER() OVER (PARTITION BY ROUTETRANSACTIONTYPE_ID ORDER BY ROUTETRANSACTIONTYPE_ID ASC) AS ROWNUMBER
      FROM ROUTETRANSTYPEREASONCODE RTY
                ) T
      ON (R.ROUTETRANSACTIONTYPE_ID = T.ROUTETRANSACTIONTYPE_ID AND R.REASONCODE_ID = T.REASONCODE_ID)
      WHEN MATCHED THEN UPDATE SET R.SEQUENCENUMBER = T.ROWNUMBER;

COMMIT;

ALTER TABLE ROUTETRANSTYPEREASONCODE
	MODIFY (SEQUENCENUMBER NUMBER NOT NULL);