Quote:
The problem I am having is that an Oracle Sequence number is being generated even when invalid data is being entered.
Put aside other issues, I would like to know what made you think or say that a sequence number is being generated. Many people don't realize that Oracle does not grantee that sequence numbers will be continuous - it is "directional" and unique but not necessarily continuous - there can be gaps easily.
Also sequence numbers are cached for connections. This shows easily, especially in testing environment where pooled connections can be easily retired (easier than production environment as there are simply not enough transactions going through).
Above when I said directional, I put quotes around it. The reason being that it is not truly one direction at all levels. Say you have two pooled connections - one got 10 cached values of a sequence: for example 10 to 19, and second connection came in and got next 10: 20 - 29. Imagine this sequence of events: connection 1 uses its first value - 10, connection 2 independently uses its first value - 20, than connection 1 uses its second value - 11. When an observer looks at this at a grand level, he sees 10, 20, 11, it's obviously not even directional.