User, can you give us some information about the product you are using?
It's not clear if you want to do this in java, pl/sql, C, C++, c# ....
Once you have provided the info we can move the question to the right form. Or you look for the right forum yourself and post the question there again. In this case you should add the version of the product you are using. Help for this: Re: Introduce yourself!
you can concatenate the values and compute the difference
If this is negative, then you can throw an error.
Oracle database has a datatype "DATE" that stores dates with a detail up to the second;
And Oracle can "translate" strings of chars representing a date (even with the format using AM/PM) into its internal DATE datatype.
There is a nice feature with Oracle DATEs: "date arithmetic": if "d2" and "d1" are two DATEs,
- if we do d2 - d1 the result is the number of days between the two dates (and the result can have a decimal part as the number of days can be for example 0.000011574... for a difference of one second)
- or if we add (or subtract) a number X to a DATE, the result is another DATE with the number X of days added (subtracted) ; example: SYSDATE - 3 / 24 is "three hours ago"; d1 + 185 / 1440 is "3 hours and 5 minutes after d1" ... (as there are 24 * 60 = 1440 minutes in 1 day, so 185 / 1440 day = 180 minutes + 5 minutes = 3H05')
Knowing those points you should be able to use Oracle to "do the maths for you" ;-)
And for your case you just have to know if a date is anterior to another; if you have stored your 2 dates in D1 and D2, it is as simple as
IF d1 < d2 THEN ... END IF;