In have a table called PRODUCTS, table structure and records can be found here.
PRODUCT_NO_REGISTRATION_NO is allowed to be used until that is returned back. i.e. There should not be any PRODUCT_NO_REGISTRATION_NO clashing or overlapping with other PRODUCT_NO. We return the products and return date is entered in ACTUAL_RETURN_DATE and if ACTUAL_RETURN_DATE is null we take END_DATE as return date.
If user wants to extend PRODUCTS, they extend the END_DATE by adding another record with PRODUCT_EXTENSION_NO, so a product can be used till the extension ends. By doing so PRODUCT_NO remains the same along with PRODUCT_NO_REGISTRATION_NO, only extension will be in sequence like 0,1,2 . For extension records START_DATE remains the same along with PRODUCT_NO and PRODUCT_NO_REGISTRATION_NO and extension will be in sequence like 0,1,2.
How can I find out whether records are clashing or overlapping except for extension records?
E.g. if you see the records PRODUCT_NO - ORP76 with PRODUCT_EXTENSION_NO - 1 is clashing with PRODUCT_NO- ORP100 with PRODUCT_EXTENSION_NO - 0.
Any help is highly appreciable.
P.S. Database is Oracle 10g on Solaris
Regards