HOW TO WRITE ORACLE PLSQL PROCEDURE TO GET THIS OUTPUT? : table A:Present data

A               VALID_FROM            VALID_TO
------------   ----------------     ----------------
ARN-1           01-APR-2015          31-DEC-9999
ARN-1           01-MAY-2015          31-DEC-9999
ARN-1           01-JUN-2015          31-DEC-9999 

table B:Required output after insertion

A               VALID_FROM            VALID_TO
------------   ----------------     ----------------
ARN-1           01-APR-2015          30-APR-2015
ARN-1           01-MAY-2015          31-MAY-2015
ARN-1           01-JUN-2015          31-DEC-9999

HOW TO WRITE ORACLE PLSQL PROCEDURE TO GET THIS OUTPUT??

